1 """Entity classes for the Airzone integration."""
3 from __future__
import annotations
8 from aioairzone.const
import (
26 from aioairzone.exceptions
import AirzoneError
34 from .
import AirzoneConfigEntry
35 from .const
import DOMAIN, MANUFACTURER
36 from .coordinator
import AirzoneUpdateCoordinator
38 _LOGGER = logging.getLogger(__name__)
42 """Define an Airzone entity."""
44 _attr_has_entity_name =
True
47 """Return Airzone entity value by key."""
48 raise NotImplementedError
52 """Define an Airzone System entity."""
56 coordinator: AirzoneUpdateCoordinator,
57 entry: AirzoneConfigEntry,
58 system_data: dict[str, Any],
66 identifiers={(DOMAIN, f
"{entry.entry_id}_{self.system_id}")},
67 manufacturer=MANUFACTURER,
69 name=f
"System {self.system_id}",
71 via_device=(DOMAIN, f
"{entry.entry_id}_ws"),
77 """Return system availability."""
81 """Return system value by key."""
83 if system := self.coordinator.data[AZD_SYSTEMS].
get(self.
system_idsystem_id):
90 """Define an Airzone Hot Water entity."""
94 coordinator: AirzoneUpdateCoordinator,
101 identifiers={(DOMAIN, f
"{entry.entry_id}_dhw")},
102 manufacturer=MANUFACTURER,
105 via_device=(DOMAIN, f
"{entry.entry_id}_ws"),
110 """Return DHW value by key."""
111 return self.coordinator.data[AZD_HOT_WATER].
get(key)
114 """Send DHW parameters to API."""
119 _LOGGER.debug(
"update_dhw_params=%s", _params)
121 await self.coordinator.airzone.set_dhw_parameters(_params)
122 except AirzoneError
as error:
129 """Define an Airzone WebServer entity."""
133 coordinator: AirzoneUpdateCoordinator,
142 connections={(dr.CONNECTION_NETWORK_MAC, mac)},
143 identifiers={(DOMAIN, f
"{entry.entry_id}_ws")},
144 manufacturer=MANUFACTURER,
152 """Return system value by key."""
153 return self.coordinator.data[AZD_WEBSERVER].
get(key)
157 """Define an Airzone Zone entity."""
161 coordinator: AirzoneUpdateCoordinator,
164 zone_data: dict[str, Any],
174 identifiers={(DOMAIN, f
"{entry.entry_id}_{system_zone_id}")},
175 manufacturer=MANUFACTURER,
177 name=zone_data[AZD_NAME],
179 via_device=(DOMAIN, f
"{entry.entry_id}_{self.system_id}"),
185 """Return zone availability."""
189 """Return zone value by key."""
191 if zone := self.coordinator.data[AZD_ZONES].
get(self.
system_zone_idsystem_zone_id):
197 """Send HVAC parameters to API."""
200 API_ZONE_ID: self.
zone_idzone_id,
203 _LOGGER.debug(
"update_hvac_params=%s", _params)
205 await self.coordinator.airzone.set_hvac_parameters(_params)
206 except AirzoneError
as error:
208 f
"Failed to set zone {self.entity_id}: {error}"
Any get_airzone_value(self, str key)
Any get_airzone_value(self, str key)
None _async_update_dhw_params(self, dict[str, Any] params)
None __init__(self, AirzoneUpdateCoordinator coordinator, ConfigEntry entry)
Any get_airzone_value(self, str key)
None __init__(self, AirzoneUpdateCoordinator coordinator, AirzoneConfigEntry entry, dict[str, Any] system_data)
Any get_airzone_value(self, str key)
None __init__(self, AirzoneUpdateCoordinator coordinator, ConfigEntry entry)
None __init__(self, AirzoneUpdateCoordinator coordinator, ConfigEntry entry, str system_zone_id, dict[str, Any] zone_data)
Any get_airzone_value(self, str key)
None _async_update_hvac_params(self, dict[str, Any] params)
None async_set_updated_data(self, _DataT data)
web.Response get(self, web.Request request, str config_key)