Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Airzone Aidoo in ZHA #117191

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 55 additions & 4 deletions homeassistant/components/zha/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
ATTR_TARGET_TEMP_LOW,
FAN_AUTO,
FAN_ON,
FAN_OFF,
FAN_LOW,
FAN_MEDIUM,
FAN_HIGH,
PRESET_AWAY,
PRESET_BOOST,
PRESET_COMFORT,
Expand Down Expand Up @@ -107,6 +111,24 @@
T.SystemMode.Sleep: HVACMode.OFF,
}

FAN_MODE_2_FAN = {
F.FanMode.On: FAN_ON,
F.FanMode.Off: FAN_OFF,
F.FanMode.Auto: FAN_AUTO,
F.FanMode.Low: FAN_LOW,
F.FanMode.Medium: FAN_MEDIUM,
F.FanMode.High: FAN_HIGH,
}

FAN_2_FAN_MODE = {
FAN_ON: F.FanMode.On,
FAN_OFF: F.FanMode.Off,
FAN_AUTO: F.FanMode.Auto,
FAN_LOW: F.FanMode.Low,
FAN_MEDIUM: F.FanMode.Medium,
FAN_HIGH: F.FanMode.High,
}

ZCL_TEMP = 100


Expand Down Expand Up @@ -394,10 +416,7 @@ async def async_set_fan_mode(self, fan_mode: str) -> None:
self.warning("Unsupported '%s' fan mode", fan_mode)
return

if fan_mode == FAN_ON:
mode = F.FanMode.On
else:
mode = F.FanMode.Auto
mode = FAN_2_FAN_MODE.get(fan_mode, F.FanMode.Auto)

await self._fan.async_set_speed(mode)

Expand Down Expand Up @@ -823,3 +842,35 @@ async def async_preset_handler(self, preset: str, enable: bool = False) -> None:
return await self._thrm.write_attributes_safe(
{"operation_preset": 4}, manufacturer=mfg_code
)


@MULTI_MATCH(
cluster_handler_names=CLUSTER_HANDLER_THERMOSTAT,
aux_cluster_handlers=CLUSTER_HANDLER_FAN,
manufacturers="Airzone",
models={"Aidoo Zigbee"},
stop_on_match_group=CLUSTER_HANDLER_THERMOSTAT,
)
class AirzoneThermostat(Thermostat):
"""Airzone Thermostat implementation."""

@property
def fan_mode(self) -> str | None:
"""Return current FAN mode."""
return FAN_MODE_2_FAN.get(self._fan.fan_mode)

@property
def fan_modes(self) -> list[str] | None:
return [FAN_LOW, FAN_MEDIUM, FAN_HIGH, FAN_AUTO]

@property
def hvac_modes(self) -> list[HVACMode]:
"""Return the list of available HVAC operation modes."""
return [
HVACMode.OFF,
HVACMode.HEAT_COOL,
HVACMode.COOL,
HVACMode.HEAT,
HVACMode.FAN_ONLY,
HVACMode.DRY
]