mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Explicitly pass in the config_entry in ridwell coordinator (#137973)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
20707b94b5
commit
bdcf2a1e56
@ -17,7 +17,7 @@ PLATFORMS: list[Platform] = [Platform.CALENDAR, Platform.SENSOR, Platform.SWITCH
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up Ridwell from a config entry."""
|
||||
coordinator = RidwellDataUpdateCoordinator(hass, name=entry.title)
|
||||
coordinator = RidwellDataUpdateCoordinator(hass, entry)
|
||||
await coordinator.async_initialize()
|
||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = coordinator
|
||||
|
||||
|
@ -29,7 +29,7 @@ class RidwellDataUpdateCoordinator(
|
||||
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(self, hass: HomeAssistant, *, name: str) -> None:
|
||||
def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
|
||||
"""Initialize."""
|
||||
# These will be filled in by async_initialize; we give them these defaults to
|
||||
# avoid arduous typing checks down the line:
|
||||
@ -37,7 +37,13 @@ class RidwellDataUpdateCoordinator(
|
||||
self.dashboard_url = ""
|
||||
self.user_id = ""
|
||||
|
||||
super().__init__(hass, LOGGER, name=name, update_interval=UPDATE_INTERVAL)
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=config_entry.title,
|
||||
update_interval=UPDATE_INTERVAL,
|
||||
)
|
||||
|
||||
async def _async_update_data(self) -> dict[str, list[RidwellPickupEvent]]:
|
||||
"""Fetch the latest data from the source."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user