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 moehlenhoff_alpha2 coordinator (#138083)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
020e8fe939
commit
fa1a03ded1
@ -17,7 +17,7 @@ PLATFORMS = [Platform.BINARY_SENSOR, Platform.BUTTON, Platform.CLIMATE, Platform
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up a config entry."""
|
"""Set up a config entry."""
|
||||||
base = Alpha2Base(entry.data[CONF_HOST])
|
base = Alpha2Base(entry.data[CONF_HOST])
|
||||||
coordinator = Alpha2BaseCoordinator(hass, base)
|
coordinator = Alpha2BaseCoordinator(hass, entry, base)
|
||||||
|
|
||||||
await coordinator.async_config_entry_first_refresh()
|
await coordinator.async_config_entry_first_refresh()
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import logging
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
from moehlenhoff_alpha2 import Alpha2Base
|
from moehlenhoff_alpha2 import Alpha2Base
|
||||||
|
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.exceptions import HomeAssistantError
|
from homeassistant.exceptions import HomeAssistantError
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||||
@ -20,12 +21,17 @@ UPDATE_INTERVAL = timedelta(seconds=60)
|
|||||||
class Alpha2BaseCoordinator(DataUpdateCoordinator[dict[str, dict]]):
|
class Alpha2BaseCoordinator(DataUpdateCoordinator[dict[str, dict]]):
|
||||||
"""Keep the base instance in one place and centralize the update."""
|
"""Keep the base instance in one place and centralize the update."""
|
||||||
|
|
||||||
def __init__(self, hass: HomeAssistant, base: Alpha2Base) -> None:
|
config_entry: ConfigEntry
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self, hass: HomeAssistant, config_entry: ConfigEntry, base: Alpha2Base
|
||||||
|
) -> None:
|
||||||
"""Initialize Alpha2Base data updater."""
|
"""Initialize Alpha2Base data updater."""
|
||||||
self.base = base
|
self.base = base
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass=hass,
|
hass=hass,
|
||||||
logger=_LOGGER,
|
logger=_LOGGER,
|
||||||
|
config_entry=config_entry,
|
||||||
name="alpha2_base",
|
name="alpha2_base",
|
||||||
update_interval=UPDATE_INTERVAL,
|
update_interval=UPDATE_INTERVAL,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user