mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Pass in the config_entry in youless coordinator init (#137471)
explicitly pass in the config_entry in coordinator init
This commit is contained in:
parent
b9a9da1e1d
commit
734f531a56
@ -27,7 +27,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
except URLError as exception:
|
except URLError as exception:
|
||||||
raise ConfigEntryNotReady from exception
|
raise ConfigEntryNotReady from exception
|
||||||
|
|
||||||
youless_coordinator = YouLessCoordinator(hass, api)
|
youless_coordinator = YouLessCoordinator(hass, entry, api)
|
||||||
await youless_coordinator.async_config_entry_first_refresh()
|
await youless_coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})
|
hass.data.setdefault(DOMAIN, {})
|
||||||
|
@ -5,6 +5,7 @@ import logging
|
|||||||
|
|
||||||
from youless_api import YoulessAPI
|
from youless_api import YoulessAPI
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
|
|
||||||
@ -14,10 +15,18 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class YouLessCoordinator(DataUpdateCoordinator[None]):
|
class YouLessCoordinator(DataUpdateCoordinator[None]):
|
||||||
"""Class to manage fetching YouLess data."""
|
"""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."""
|
"""Initialize global YouLess data provider."""
|
||||||
super().__init__(
|
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
|
self.device = device
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user