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