Pass in the config_entry in youless coordinator init (#137471)
explicitly pass in the config_entry in coordinator initpull/133608/merge
parent
b9a9da1e1d
commit
734f531a56
|
@ -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, {})
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue