Don't store analytics insights info on entry level (#114429)

This commit is contained in:
Joost Lekkerkerker
2024-03-29 19:29:09 +01:00
committed by GitHub
parent eb0aa6bb82
commit 1c151d78a4
2 changed files with 3 additions and 5 deletions

View File

@@ -49,9 +49,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = AnalyticsInsightsData(
coordinator=coordinator, names=names
)
hass.data[DOMAIN] = AnalyticsInsightsData(coordinator=coordinator, names=names)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
entry.async_on_unload(entry.add_update_listener(update_listener))
@@ -62,7 +60,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
if unload_ok := await hass.config_entries.async_unload_platforms(entry, PLATFORMS):
hass.data[DOMAIN].pop(entry.entry_id)
hass.data.pop(DOMAIN)
return unload_ok

View File

@@ -65,7 +65,7 @@ async def async_setup_entry(
) -> None:
"""Initialize the entries."""
analytics_data: AnalyticsInsightsData = hass.data[DOMAIN][entry.entry_id]
analytics_data: AnalyticsInsightsData = hass.data[DOMAIN]
coordinator: HomeassistantAnalyticsDataUpdateCoordinator = (
analytics_data.coordinator
)