Home Assistant Unofficial Reference 2024.12.1
coordinator.py
Go to the documentation of this file.
1 """Component to embed nexia devices."""
2 
3 from __future__ import annotations
4 
5 from datetime import timedelta
6 import logging
7 from typing import Any
8 
9 from nexia.home import NexiaHome
10 
11 from homeassistant.core import HomeAssistant
12 from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
13 
14 _LOGGER = logging.getLogger(__name__)
15 
16 DEFAULT_UPDATE_RATE = 120
17 
18 
20  """DataUpdateCoordinator for nexia homes."""
21 
22  def __init__(
23  self,
24  hass: HomeAssistant,
25  nexia_home: NexiaHome,
26  ) -> None:
27  """Initialize DataUpdateCoordinator for the nexia home."""
28  self.nexia_homenexia_home = nexia_home
29  super().__init__(
30  hass,
31  _LOGGER,
32  name="Nexia update",
33  update_interval=timedelta(seconds=DEFAULT_UPDATE_RATE),
34  always_update=False,
35  )
36 
37  async def _async_update_data(self) -> dict[str, Any]:
38  """Fetch data from API endpoint."""
39  return await self.nexia_homenexia_home.update()
None __init__(self, HomeAssistant hass, NexiaHome nexia_home)
Definition: coordinator.py:26
IssData update(pyiss.ISS iss)
Definition: __init__.py:33