Home Assistant Unofficial Reference 2024.12.1
coordinator.py
Go to the documentation of this file.
1 """Coordinator for the mill component."""
2 
3 from __future__ import annotations
4 
5 from datetime import timedelta
6 import logging
7 
8 from mill import Mill
9 from mill_local import Mill as MillLocal
10 
11 from homeassistant.core import HomeAssistant
12 from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
13 
14 from .const import DOMAIN
15 
16 _LOGGER = logging.getLogger(__name__)
17 
18 
20  """Class to manage fetching Mill data."""
21 
22  def __init__(
23  self,
24  hass: HomeAssistant,
25  update_interval: timedelta | None = None,
26  *,
27  mill_data_connection: Mill | MillLocal,
28  ) -> None:
29  """Initialize global Mill data updater."""
30  self.mill_data_connectionmill_data_connection = mill_data_connection
31 
32  super().__init__(
33  hass,
34  _LOGGER,
35  name=DOMAIN,
36  update_method=mill_data_connection.fetch_heater_and_sensor_data,
37  update_interval=update_interval,
38  )
None __init__(self, HomeAssistant hass, timedelta|None update_interval=None, *Mill|MillLocal mill_data_connection)
Definition: coordinator.py:28