zigpy / zha

Zigbee Home Automation
Apache License 2.0
24 stars 21 forks source link

Fan control interface does not display options correctly #226

Open Masy opened 1 week ago

Masy commented 1 week ago

I'm currently developing a stick that can control midea AC units, and i stumbled upon a weird behavior when exposing a fan control cluster:

6.4.2.2.2 of the zigbee cluster specification states that the fan mode sequence attribute should be set to 0x02 if the fan supports low/med/high/auto modes. grafik

This does seem to be picked up correctly by home assistant / ZHA: grafik

However, in the interface, the only options are 'on' and 'auto', which corresponds to 0x04: grafik

Masy commented 1 week ago

I noticed the thermostat isn't displayed correctly as well. I set the ControlSequenceOfOperation to 0x04, which should display all possible modes of SystemMode. grafik grafik

The only displayed modes for me are off, cool, heat and auto. If i manually set the SystemMode to dry when initializing the zigbee device on the ESP32C6 it is displayed in HA, but i can't set it via the interface. grafik

puddly commented 1 week ago

HVAC operations are sort of split up between climate modes, default climate presets, and custom climate presets. We map them to one of the supported Home Assistant climate modes here and create presets on a thermostat-by-thermostat basis: https://github.com/zigpy/zha/blob/4a4abd2e01f4e1a144550171d91e736a932ae37d/zha/application/platforms/climate/const.py#L150-L169.

I think for this attribute to work, the various modes from the ZCL would need to be turned into custom presets.

Does your device actually support all of the ZCL modes? If not, which ones does it support?

Masy commented 6 days ago

the only thing im unsure about is if the eco mode corresponds to precooling, but i guess it supports all modes of the zigbee standard mentioned in table 6-16

Masy commented 5 days ago

so my understanding is that precooling basically saves energy by pre-cooling air in the morning so the building can be cooled more efficiently during hotter parts of the day. in contrast, eco mode just runs the compressor with less power. so technically they are not the same, although both are aimed at reducing energy cost.

however, since the zigbee standard does not support an eco mode, i would use the precooling mode as eco mode for my use case.

i'm not sure whats the best solution here, but i would at least support emergency heat, fan only, dry and sleep for climate devices

puddly commented 5 days ago

We can display the modes (the draft PR I'm working on above does this) but it may have to be gated behind a quirk, depending on device support. It's a little frustrating that the spec makes some of these modes all-or-nothing, without allowing any sort of support bitfield.

I'll have to look at how other thermostats report their capabilities.

Masy commented 5 days ago

its funny how the zigbee standard states that not all SystemMode / ControlSequenceOfOperation values have to be supported, yet doesn't offer a way to report which are

Masy commented 2 days ago

would it be possible to just add the missing modes to the SEQ_OF_OPERATION array for now? I need to be able to select these modes to properly develop the firmware for the stick. Otherwise i would fork ZHA and do it myself until its properly fixed, but that would make things complicated because i have to install a custom version of the integration