Explicitly pass in the config_entry in nexia coordinator (#138073)
parent
e496270c6b
commit
18ea407276
|
@ -58,7 +58,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: NexiaConfigEntry) -> boo
|
||||||
f"Error connecting to Nexia service: {os_error}"
|
f"Error connecting to Nexia service: {os_error}"
|
||||||
) from os_error
|
) from os_error
|
||||||
|
|
||||||
coordinator = NexiaDataUpdateCoordinator(hass, nexia_home)
|
coordinator = NexiaDataUpdateCoordinator(hass, entry, nexia_home)
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
entry.runtime_data = coordinator
|
entry.runtime_data = coordinator
|
||||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||||
|
|
|
@ -8,6 +8,7 @@ from typing import Any
|
||||||
|
|
||||||
from nexia.home import NexiaHome
|
from nexia.home import NexiaHome
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
|
@ -19,9 +20,12 @@ DEFAULT_UPDATE_RATE = 120
|
||||||
class NexiaDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
class NexiaDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
"""DataUpdateCoordinator for nexia homes."""
|
"""DataUpdateCoordinator for nexia homes."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
nexia_home: NexiaHome,
|
nexia_home: NexiaHome,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize DataUpdateCoordinator for the nexia home."""
|
"""Initialize DataUpdateCoordinator for the nexia home."""
|
||||||
|
@ -29,6 +33,7 @@ class NexiaDataUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name="Nexia update",
|
name="Nexia update",
|
||||||
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
|
update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
|
||||||
always_update=False,
|
always_update=False,
|
||||||
|
|
Loading…
Reference in New Issue