mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Explicitly pass in the config_entry in sanix coordinator (#137960)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
61ce1fc009
commit
93dad987f8
@ -19,7 +19,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
token = entry.data[CONF_TOKEN]
|
token = entry.data[CONF_TOKEN]
|
||||||
|
|
||||||
sanix_api = Sanix(serial_no, token)
|
sanix_api = Sanix(serial_no, token)
|
||||||
coordinator = SanixCoordinator(hass, sanix_api)
|
coordinator = SanixCoordinator(hass, entry, sanix_api)
|
||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||||
|
@ -21,10 +21,16 @@ class SanixCoordinator(DataUpdateCoordinator[Measurement]):
|
|||||||
|
|
||||||
config_entry: ConfigEntry
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, sanix_api: Sanix) -> None:
|
def __init__(
|
||||||
|
self, hass: HomeAssistant, config_entry: ConfigEntry, sanix_api: Sanix
|
||||||
|
) -> None:
|
||||||
"""Initialize coordinator."""
|
"""Initialize coordinator."""
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass, _LOGGER, name=MANUFACTURER, update_interval=timedelta(hours=1)
|
hass,
|
||||||
|
_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
|
name=MANUFACTURER,
|
||||||
|
update_interval=timedelta(hours=1),
|
||||||
)
|
)
|
||||||
self._sanix_api = sanix_api
|
self._sanix_api = sanix_api
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user