diff --git a/homeassistant/components/trafikverket_weatherstation/__init__.py b/homeassistant/components/trafikverket_weatherstation/__init__.py index e17dacfdace1c5d71456d931779cde507fed391b..8fe67b5c66a307bd10ceec5ceb037100c9560434 100644 --- a/homeassistant/components/trafikverket_weatherstation/__init__.py +++ b/homeassistant/components/trafikverket_weatherstation/__init__.py @@ -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) diff --git a/homeassistant/components/trafikverket_weatherstation/coordinator.py b/homeassistant/components/trafikverket_weatherstation/coordinator.py index 22ecf6fc1b5c6f4ee9492f9df8d6d173e4da54a7..33f09c0ffe2da800c0c398473c74af05ec008132 100644 --- a/homeassistant/components/trafikverket_weatherstation/coordinator.py +++ b/homeassistant/components/trafikverket_weatherstation/coordinator.py @@ -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."""