mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Explicitly pass in the config_entry in ourgroceries coordinator (#138047)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
9110557e36
commit
e163c15bb9
@ -30,7 +30,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
except InvalidLoginException:
|
||||
return False
|
||||
|
||||
coordinator = OurGroceriesDataUpdateCoordinator(hass, og)
|
||||
coordinator = OurGroceriesDataUpdateCoordinator(hass, entry, og)
|
||||
await coordinator.async_config_entry_first_refresh()
|
||||
hass.data[DOMAIN][entry.entry_id] = coordinator
|
||||
|
||||
|
@ -8,6 +8,7 @@ import logging
|
||||
|
||||
from ourgroceries import OurGroceries
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
||||
|
||||
@ -21,7 +22,11 @@ _LOGGER = logging.getLogger(__name__)
|
||||
class OurGroceriesDataUpdateCoordinator(DataUpdateCoordinator[dict[str, dict]]):
|
||||
"""Class to manage fetching OurGroceries data."""
|
||||
|
||||
def __init__(self, hass: HomeAssistant, og: OurGroceries) -> None:
|
||||
config_entry: ConfigEntry
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, config_entry: ConfigEntry, og: OurGroceries
|
||||
) -> None:
|
||||
"""Initialize global OurGroceries data updater."""
|
||||
self.og = og
|
||||
self.lists: list[dict] = []
|
||||
@ -30,6 +35,7 @@ class OurGroceriesDataUpdateCoordinator(DataUpdateCoordinator[dict[str, dict]]):
|
||||
super().__init__(
|
||||
hass,
|
||||
_LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=DOMAIN,
|
||||
update_interval=interval,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user