Explicitly pass in the config_entry in ondilo_ico coordinator (#138054)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-09 14:51:58 +01:00 committed by GitHub
parent a0e7560b1e
commit e050238106
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -28,7 +28,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
) )
) )
coordinator = OndiloIcoCoordinator(hass, OndiloClient(hass, entry, implementation)) coordinator = OndiloIcoCoordinator(
hass, entry, OndiloClient(hass, entry, implementation)
)
await coordinator.async_config_entry_first_refresh() await coordinator.async_config_entry_first_refresh()

View File

@ -7,6 +7,7 @@ from typing import Any
from ondilo import OndiloError from ondilo import OndiloError
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
@ -28,11 +29,16 @@ class OndiloIcoData:
class OndiloIcoCoordinator(DataUpdateCoordinator[dict[str, OndiloIcoData]]): class OndiloIcoCoordinator(DataUpdateCoordinator[dict[str, OndiloIcoData]]):
"""Class to manage fetching Ondilo ICO data from API.""" """Class to manage fetching Ondilo ICO data from API."""
def __init__(self, hass: HomeAssistant, api: OndiloClient) -> None: config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, api: OndiloClient
) -> None:
"""Initialize.""" """Initialize."""
super().__init__( super().__init__(
hass, hass,
logger=_LOGGER, logger=_LOGGER,
config_entry=config_entry,
name=DOMAIN, name=DOMAIN,
update_interval=timedelta(hours=1), update_interval=timedelta(hours=1),
) )