Explicitly pass in the config_entry in permobil coordinator (#138043)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 17:36:04 +01:00 committed by GitHub
parent e3822ed277
commit 0e4db4265a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -48,7 +48,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
raise ConfigEntryAuthFailed(f"Config error for {p_api.email}") from err
# create the coordinator with the API object
coordinator = MyPermobilCoordinator(hass, p_api)
coordinator = MyPermobilCoordinator(hass, entry, p_api)
await coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator

View File

@ -7,6 +7,7 @@ import logging
from mypermobil import MyPermobil, MyPermobilAPIException
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -25,11 +26,16 @@ class MyPermobilData:
class MyPermobilCoordinator(DataUpdateCoordinator[MyPermobilData]):
"""MyPermobil coordinator."""
def __init__(self, hass: HomeAssistant, p_api: MyPermobil) -> None:
config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, p_api: MyPermobil
) -> None:
"""Initialize my coordinator."""
super().__init__(
hass,
_LOGGER,
config_entry=config_entry,
name="permobil",
update_interval=timedelta(minutes=5),
)