mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Explicitly pass in the config_entry in hko coordinator (#138154)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
d9a17506f5
commit
39bcef63bd
@ -25,7 +25,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
)[KEY_DISTRICT]
|
||||
websession = async_get_clientsession(hass)
|
||||
|
||||
coordinator = HKOUpdateCoordinator(hass, websession, district, location)
|
||||
coordinator = HKOUpdateCoordinator(hass, entry, websession, district, location)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
|
@ -26,6 +26,7 @@ from homeassistant.components.weather import (
|
||||
ATTR_FORECAST_TEMP_LOW,
|
||||
ATTR_FORECAST_TIME,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
|
||||
@ -69,8 +70,15 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class HKOUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
"""HKO Update Coordinator."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, session: ClientSession, district: str, location: str
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
session: ClientSession,
|
||||
district: str,
|
||||
location: str,
|
||||
) -> None:
|
||||
"""Update data via library."""
|
||||
self.location = location
|
||||
@ -80,6 +88,7 @@ class HKOUpdateCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=timedelta(minutes=15),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user