Explicitly set config entry in Trafikverket Ferry coordinator (#134305)
parent
9f1023b195
commit
428a74fa48
|
@ -14,7 +14,7 @@ TVFerryConfigEntry = ConfigEntry[TVDataUpdateCoordinator]
|
|||
async def async_setup_entry(hass: HomeAssistant, entry: TVFerryConfigEntry) -> bool:
|
||||
"""Set up Trafikverket Ferry 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)
|
||||
|
|
|
@ -52,21 +52,22 @@ class TVDataUpdateCoordinator(DataUpdateCoordinator):
|
|||
|
||||
config_entry: TVFerryConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: TVFerryConfigEntry) -> None:
|
||||
"""Initialize the Trafikverket coordinator."""
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=TIME_BETWEEN_UPDATES,
|
||||
)
|
||||
self._ferry_api = TrafikverketFerry(
|
||||
async_get_clientsession(hass), self.config_entry.data[CONF_API_KEY]
|
||||
async_get_clientsession(hass), config_entry.data[CONF_API_KEY]
|
||||
)
|
||||
self._from: str = self.config_entry.data[CONF_FROM]
|
||||
self._to: str = self.config_entry.data[CONF_TO]
|
||||
self._time: time | None = dt_util.parse_time(self.config_entry.data[CONF_TIME])
|
||||
self._weekdays: list[str] = self.config_entry.data[CONF_WEEKDAY]
|
||||
self._from: str = config_entry.data[CONF_FROM]
|
||||
self._to: str = config_entry.data[CONF_TO]
|
||||
self._time: time | None = dt_util.parse_time(config_entry.data[CONF_TIME])
|
||||
self._weekdays: list[str] = config_entry.data[CONF_WEEKDAY]
|
||||
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Fetch data from Trafikverket."""
|
||||
|
|
Loading…
Reference in New Issue