Set config_entry explicitly in switcher kis coordinator (#129419)

This commit is contained in:
epenet 2024-10-29 15:14:36 +01:00 committed by GitHub
parent 10fdf819d3
commit 8f7ae2665c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -23,6 +23,8 @@ class SwitcherDataUpdateCoordinator(
): ):
"""Switcher device data update coordinator.""" """Switcher device data update coordinator."""
config_entry: ConfigEntry
def __init__( def __init__(
self, self,
hass: HomeAssistant, hass: HomeAssistant,
@ -33,10 +35,10 @@ class SwitcherDataUpdateCoordinator(
super().__init__( super().__init__(
hass, hass,
_LOGGER, _LOGGER,
config_entry=entry,
name=device.name, name=device.name,
update_interval=timedelta(seconds=MAX_UPDATE_INTERVAL_SEC), update_interval=timedelta(seconds=MAX_UPDATE_INTERVAL_SEC),
) )
self.entry = entry
self.data = device self.data = device
self.token = entry.data.get(CONF_TOKEN) self.token = entry.data.get(CONF_TOKEN)
@ -67,7 +69,7 @@ class SwitcherDataUpdateCoordinator(
"""Set up the coordinator.""" """Set up the coordinator."""
dev_reg = dr.async_get(self.hass) dev_reg = dr.async_get(self.hass)
dev_reg.async_get_or_create( dev_reg.async_get_or_create(
config_entry_id=self.entry.entry_id, config_entry_id=self.config_entry.entry_id,
connections={(dr.CONNECTION_NETWORK_MAC, self.mac_address)}, connections={(dr.CONNECTION_NETWORK_MAC, self.mac_address)},
identifiers={(DOMAIN, self.device_id)}, identifiers={(DOMAIN, self.device_id)},
manufacturer="Switcher", manufacturer="Switcher",