mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Explicitly pass in the config_entry in flo coordinator (#137819)
explicitly pass in the config_entry in coordinator
This commit is contained in:
parent
86e44fc1cf
commit
f8ac48fc78
@ -37,7 +37,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
_LOGGER.debug("Flo user information with locations: %s", user_info)
|
||||
|
||||
hass.data[DOMAIN][entry.entry_id]["devices"] = devices = [
|
||||
FloDeviceDataUpdateCoordinator(hass, client, location["id"], device["id"])
|
||||
FloDeviceDataUpdateCoordinator(
|
||||
hass, entry, client, location["id"], device["id"]
|
||||
)
|
||||
for location in user_info["locations"]
|
||||
for device in location["devices"]
|
||||
]
|
||||
|
@ -10,6 +10,7 @@ from aioflo.api import API
|
||||
from aioflo.errors import RequestError
|
||||
from orjson import JSONDecodeError
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||
from homeassistant.util import dt as dt_util
|
||||
@ -20,10 +21,16 @@ from .const import DOMAIN as FLO_DOMAIN, LOGGER
|
||||
class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
"""Flo device object."""
|
||||
|
||||
config_entry: ConfigEntry
|
||||
_failure_count: int = 0
|
||||
|
||||
def __init__(
|
||||
self, hass: HomeAssistant, api_client: API, location_id: str, device_id: str
|
||||
self,
|
||||
hass: HomeAssistant,
|
||||
config_entry: ConfigEntry,
|
||||
api_client: API,
|
||||
location_id: str,
|
||||
device_id: str,
|
||||
) -> None:
|
||||
"""Initialize the device."""
|
||||
self.hass: HomeAssistant = hass
|
||||
@ -36,6 +43,7 @@ class FloDeviceDataUpdateCoordinator(DataUpdateCoordinator):
|
||||
super().__init__(
|
||||
hass,
|
||||
LOGGER,
|
||||
config_entry=config_entry,
|
||||
name=f"{FLO_DOMAIN}-{device_id}",
|
||||
update_interval=timedelta(seconds=60),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user