Pass config_entry as param to Shelly coordinator (#137276)

* Pass config_entry as param

* diff approach
This commit is contained in:
Simone Chemelli 2025-02-03 22:58:50 +01:00 committed by GitHub
parent 6fa87da5bd
commit 1654c28d74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -17,7 +17,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
entry.data[CONF_HOST], entry.data[CONF_HOST],
entry.data[CONF_USERNAME], entry.data[CONF_USERNAME],
entry.data[CONF_PASSWORD], entry.data[CONF_PASSWORD],
entry.unique_id, entry,
) )
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()

View File

@ -50,7 +50,7 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]):
host: str, host: str,
username: str, username: str,
password: str, password: str,
config_entry_unique_id: str | None, config_entry: ConfigEntry,
) -> None: ) -> None:
"""Initialize the scanner.""" """Initialize the scanner."""
@ -58,13 +58,14 @@ class VodafoneStationRouter(DataUpdateCoordinator[UpdateCoordinatorDataType]):
self.api = VodafoneStationSercommApi(host, username, password) self.api = VodafoneStationSercommApi(host, username, password)
# Last resort as no MAC or S/N can be retrieved via API # Last resort as no MAC or S/N can be retrieved via API
self._id = config_entry_unique_id self._id = config_entry.unique_id
super().__init__( super().__init__(
hass=hass, hass=hass,
logger=_LOGGER, logger=_LOGGER,
name=f"{DOMAIN}-{host}-coordinator", name=f"{DOMAIN}-{host}-coordinator",
update_interval=timedelta(seconds=SCAN_INTERVAL), update_interval=timedelta(seconds=SCAN_INTERVAL),
config_entry=config_entry,
) )
device_reg = dr.async_get(self.hass) device_reg = dr.async_get(self.hass)
device_list = dr.async_entries_for_config_entry( device_list = dr.async_entries_for_config_entry(