Pass in the config_entry in youless coordinator init (#137471)

explicitly pass in the config_entry in coordinator init
pull/133608/merge
Michael 2025-02-07 09:46:53 +01:00 committed by GitHub
parent b9a9da1e1d
commit 734f531a56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
except URLError as exception:
raise ConfigEntryNotReady from exception
youless_coordinator = YouLessCoordinator(hass, api)
youless_coordinator = YouLessCoordinator(hass, entry, api)
await youless_coordinator.async_config_entry_first_refresh()
hass.data.setdefault(DOMAIN, {})

View File

@ -5,6 +5,7 @@ import logging
from youless_api import YoulessAPI
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
@ -14,10 +15,18 @@ _LOGGER = logging.getLogger(__name__)
class YouLessCoordinator(DataUpdateCoordinator[None]):
"""Class to manage fetching YouLess data."""
def __init__(self, hass: HomeAssistant, device: YoulessAPI) -> None:
config_entry: ConfigEntry
def __init__(
self, hass: HomeAssistant, config_entry: ConfigEntry, device: YoulessAPI
) -> None:
"""Initialize global YouLess data provider."""
super().__init__(
hass, _LOGGER, name="youless_gateway", update_interval=timedelta(seconds=10)
hass,
_LOGGER,
config_entry=config_entry,
name="youless_gateway",
update_interval=timedelta(seconds=10),
)
self.device = device