Explicitly pass in the config_entry in ridwell coordinator (#137973)

explicitly pass in the config_entry in coordinator
This commit is contained in:
Michael 2025-02-08 22:18:55 +01:00 committed by GitHub
parent 20707b94b5
commit bdcf2a1e56
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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."""