Home Assistant Unofficial Reference 2024.12.1
coordinator.py
Go to the documentation of this file.
1 """Coordinator for the Melnor integration."""
2 
3 from datetime import timedelta
4 import logging
5 
6 from melnor_bluetooth.device import Device
7 
8 from homeassistant.core import HomeAssistant
9 from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
10 
11 _LOGGER = logging.getLogger(__name__)
12 
13 
15  """Melnor data update coordinator."""
16 
17  _device: Device
18 
19  def __init__(self, hass: HomeAssistant, device: Device) -> None:
20  """Initialize my coordinator."""
21  super().__init__(
22  hass,
23  _LOGGER,
24  name="Melnor Bluetooth",
25  update_interval=timedelta(seconds=5),
26  )
27  self._device_device = device
28 
29  async def _async_update_data(self):
30  """Update the device state."""
31 
32  await self._device_device.fetch_state()
33  return self._device_device
None __init__(self, HomeAssistant hass, Device device)
Definition: coordinator.py:19