Explicitly pass in the config_entry in nexia coordinator (#138073)

pull/137224/head
Michael 2025-02-09 16:24:28 +01:00 committed by GitHub
parent e496270c6b
commit 18ea407276
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -58,7 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NexiaConfigEntry) -> boo
f"Error connecting to Nexia service: {os_error}"
) from os_error
coordinator = NexiaDataUpdateCoordinator(hass, nexia_home)
coordinator = NexiaDataUpdateCoordinator(hass, entry, nexia_home)
await coordinator.async_config_entry_first_refresh()
entry.runtime_data = coordinator
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

View File

@ -8,6 +8,7 @@ from typing import Any
from nexia.home import NexiaHome
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
@ -19,9 +20,12 @@ DEFAULT_UPDATE_RATE = 120
class NexiaDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
"""DataUpdateCoordinator for nexia homes."""
config_entry: ConfigEntry
def __init__(
self,
hass: HomeAssistant,
config_entry: ConfigEntry,
nexia_home: NexiaHome,
) -> None:
"""Initialize DataUpdateCoordinator for the nexia home."""
@ -29,6 +33,7 @@ class NexiaDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name="Nexia update",
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
always_update=False,