mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Explicitly pass in the config_entry in nuki coordinator (#138064)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
2bea300a7b
commit
9d6b031bf9
@ -222,7 +222,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _stop_nuki)
|
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, _stop_nuki)
|
||||||
)
|
)
|
||||||
|
|
||||||
coordinator = NukiCoordinator(hass, bridge, locks, openers)
|
coordinator = NukiCoordinator(hass, entry, bridge, locks, openers)
|
||||||
hass.data[DOMAIN][entry.entry_id] = NukiEntryData(
|
hass.data[DOMAIN][entry.entry_id] = NukiEntryData(
|
||||||
coordinator=coordinator,
|
coordinator=coordinator,
|
||||||
bridge=bridge,
|
bridge=bridge,
|
||||||
|
@ -12,6 +12,7 @@ from pynuki.bridge import InvalidCredentialsException
|
|||||||
from pynuki.device import NukiDevice
|
from pynuki.device import NukiDevice
|
||||||
from requests.exceptions import RequestException
|
from requests.exceptions import RequestException
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import Platform
|
from homeassistant.const import Platform
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers import entity_registry as er
|
from homeassistant.helpers import entity_registry as er
|
||||||
@ -28,9 +29,12 @@ UPDATE_INTERVAL = timedelta(seconds=30)
|
|||||||
class NukiCoordinator(DataUpdateCoordinator[None]):
|
class NukiCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""Data Update Coordinator for the Nuki integration."""
|
"""Data Update Coordinator for the Nuki integration."""
|
||||||
|
|
||||||
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
bridge: NukiBridge,
|
bridge: NukiBridge,
|
||||||
locks: list[NukiLock],
|
locks: list[NukiLock],
|
||||||
openers: list[NukiOpener],
|
openers: list[NukiOpener],
|
||||||
@ -39,9 +43,8 @@ class NukiCoordinator(DataUpdateCoordinator[None]):
|
|||||||
super().__init__(
|
super().__init__(
|
||||||
hass,
|
hass,
|
||||||
_LOGGER,
|
_LOGGER,
|
||||||
# Name of the data. For logging purposes.
|
config_entry=config_entry,
|
||||||
name="nuki devices",
|
name="nuki devices",
|
||||||
# Polling interval. Will only be polled if there are subscribers.
|
|
||||||
update_interval=UPDATE_INTERVAL,
|
update_interval=UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
self.bridge = bridge
|
self.bridge = bridge
|
||||||
|
Loading…
x
Reference in New Issue
Block a user