1 """Freedompro data update coordinator."""
3 from __future__
import annotations
5 from datetime
import timedelta
9 from pyfreedompro
import get_list, get_states
14 from .const
import DOMAIN
16 _LOGGER = logging.getLogger(__name__)
20 """Class to manage fetching Freedompro data API."""
26 self.
_devices_devices: list[dict[str, Any]] |
None =
None
29 super().
__init__(hass, _LOGGER, name=DOMAIN, update_interval=update_interval)
33 result = await get_list(
34 aiohttp_client.async_get_clientsession(self.
_hass_hass), self.
_api_key_api_key
41 result = await get_states(
42 aiohttp_client.async_get_clientsession(self.
_hass_hass), self.
_api_key_api_key
47 (dev
for dev
in result
if dev[
"uid"] == device[
"uid"]),
50 if dev
is not None and "state" in dev:
51 device[
"state"] = dev[
"state"]
def _async_update_data(self)
def __init__(self, hass, api_key)