1 """Support for the Airzone Cloud switch."""
3 from __future__
import annotations
5 from dataclasses
import dataclass
6 from typing
import Any, Final
8 from aioairzone_cloud.const
import API_POWER, API_VALUE, AZD_POWER, AZD_ZONES
13 SwitchEntityDescription,
18 from .
import AirzoneCloudConfigEntry
19 from .coordinator
import AirzoneUpdateCoordinator
20 from .entity
import AirzoneEntity, AirzoneZoneEntity
23 @dataclass(frozen=True, kw_only=True)
25 """Class to describe an Airzone switch entity."""
30 ZONE_SWITCH_TYPES: Final[tuple[AirzoneSwitchDescription, ...]] = (
33 device_class=SwitchDeviceClass.SWITCH,
41 entry: AirzoneCloudConfigEntry,
42 async_add_entities: AddEntitiesCallback,
44 """Add Airzone Cloud switch from a config_entry."""
45 coordinator = entry.runtime_data
55 for description
in ZONE_SWITCH_TYPES
56 for zone_id, zone_data
in coordinator.data.get(AZD_ZONES, {}).items()
57 if description.key
in zone_data
62 """Define an Airzone Cloud switch."""
64 entity_description: AirzoneSwitchDescription
68 """Update attributes when the coordinator updates."""
74 """Update switch attributes."""
79 """Define an Airzone Cloud Zone switch."""
83 coordinator: AirzoneUpdateCoordinator,
84 description: AirzoneSwitchDescription,
86 zone_data: dict[str, Any],
89 super().
__init__(coordinator, zone_id, zone_data)
98 """Turn the entity on."""
100 params: dict[str, Any] = {
108 """Turn the entity off."""
110 params: dict[str, Any] = {
None _async_update_params(self, dict[str, Any] params)
Any get_airzone_value(self, str key)
None _async_update_params(self, dict[str, Any] params)
None _async_update_attrs(self)
None _handle_coordinator_update(self)
None async_turn_on(self, **Any kwargs)
None __init__(self, AirzoneUpdateCoordinator coordinator, AirzoneSwitchDescription description, str zone_id, dict[str, Any] zone_data)
None async_turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, AirzoneCloudConfigEntry entry, AddEntitiesCallback async_add_entities)