1 """Coordinator for radiotherm."""
3 from __future__
import annotations
5 from datetime
import timedelta
7 from urllib.error
import URLError
9 from radiotherm.validate
import RadiothermTstatError
14 from .data
import RadioThermInitData, RadioThermUpdate, async_get_data
16 _LOGGER = logging.getLogger(__name__)
22 """DataUpdateCoordinator to gather data for radio thermostats."""
24 def __init__(self, hass: HomeAssistant, init_data: RadioThermInitData) ->
None:
25 """Initialize DataUpdateCoordinator."""
27 self.
_description_description = f
"{init_data.name} ({init_data.host})"
31 name=f
"radiotherm {self.init_data.name}",
32 update_interval=UPDATE_INTERVAL,
36 """Update data from the thermostat."""
39 except RadiothermTstatError
as ex:
40 msg = f
"{self._description} was busy (invalid value returned): {ex}"
42 except TimeoutError
as ex:
43 msg = f
"{self._description}) timed out waiting for a response: {ex}"
45 except (OSError, URLError)
as ex:
46 msg = f
"{self._description} connection error: {ex}"
None __init__(self, HomeAssistant hass, RadioThermInitData init_data)
RadioThermUpdate _async_update_data(self)
RadioThermUpdate async_get_data(HomeAssistant hass, CommonThermostat device)