1 """The radiotherm component data."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
9 from radiotherm.thermostat
import CommonThermostat
14 from .const
import TIMEOUT
19 """An update from a radiotherm device."""
27 """An data needed to init the integration."""
29 tstat: CommonThermostat
34 fw_version: str |
None
35 api_version: int |
None
39 tstat = radiotherm.get_thermostat(host)
40 tstat.timeout = TIMEOUT
41 name: str = tstat.name[
"raw"]
42 sys: dict[str, Any] = tstat.sys[
"raw"]
43 mac: str = dr.format_mac(sys[
"uuid"])
44 model: str = tstat.model.get(
"raw")
46 tstat, host, name, mac, model, sys.get(
"fw_version"), sys.get(
"api_version")
51 """Get the RadioInitData."""
52 return await hass.async_add_executor_job(_get_init_data, host)
55 def _get_data(device: CommonThermostat) -> RadioThermUpdate:
64 tstat: dict[str, Any] = device.tstat[
"raw"]
65 humidity: int |
None =
None
66 if isinstance(device, radiotherm.thermostat.CT80):
67 humidity = device.humidity[
"raw"]
72 hass: HomeAssistant, device: CommonThermostat
73 ) -> RadioThermUpdate:
74 """Fetch the data from the thermostat."""
75 return await hass.async_add_executor_job(_get_data, device)
RadioThermInitData _get_init_data(str host)
RadioThermInitData async_get_init_data(HomeAssistant hass, str host)
RadioThermUpdate _get_data(CommonThermostat device)
RadioThermUpdate async_get_data(HomeAssistant hass, CommonThermostat device)