mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Explicitly pass in the config_entry in permobil coordinator (#138043)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
e3822ed277
commit
0e4db4265a
@ -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
|
||||
|
@ -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),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user