mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Explicitly set config entry in Trafikverket Weatherstation coordinator (#134310)
This commit is contained in:
parent
256fc54aa1
commit
9f1023b195
@ -14,7 +14,7 @@ TVWeatherConfigEntry = ConfigEntry[TVDataUpdateCoordinator]
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: TVWeatherConfigEntry) -> bool:
|
||||
"""Set up Trafikverket Weatherstation from a config entry."""
|
||||
|
||||
coordinator = TVDataUpdateCoordinator(hass)
|
||||
coordinator = TVDataUpdateCoordinator(hass, entry)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
entry.runtime_data = coordinator
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
@ -34,18 +34,19 @@ class TVDataUpdateCoordinator(DataUpdateCoordinator[WeatherStationInfoModel]):
|
||||
|
||||
config_entry: TVWeatherConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: TVWeatherConfigEntry) -> None:
|
||||
"""Initialize the Sensibo coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=TIME_BETWEEN_UPDATES,
|
||||
)
|
||||
self._weather_api = TrafikverketWeather(
|
||||
async_get_clientsession(hass), self.config_entry.data[CONF_API_KEY]
|
||||
async_get_clientsession(hass), config_entry.data[CONF_API_KEY]
|
||||
)
|
||||
self._station = self.config_entry.data[CONF_STATION]
|
||||
self._station = config_entry.data[CONF_STATION]
|
||||
|
||||
async def _async_update_data(self) -> WeatherStationInfoModel:
|
||||
"""Fetch data from Trafikverket."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user