zigpy / zha-device-handlers

ZHA device handlers bridge the functionality gap created when manufacturers deviate from the ZCL specification, handling deviations and exceptions by parsing custom messages to and from Zigbee devices.
Apache License 2.0
720 stars 669 forks source link

[Technical Support] General discussion regarding Tuya TRVs - for people implementing the quirks #1183

Closed PLTorrent closed 2 years ago

PLTorrent commented 2 years ago

Hi,

As @MattWestb and @jacekk015 suggested I open a technical topic for all the tech questions regarding the implementation of the quirks for Tuya TRV.

And to start off here is a first one: Changing the range of available temperature settings. For current Saswell quirk (https://github.com/zigpy/zha-device-handlers/blob/dev/zhaquirks/tuya/ts0601_trv_sas.py) the temp range is set to 7-30 (default) however the device uses 5 -30. The setting used in quirk is not being applied.

The way I managed to change this is:

class SaswellThermostatCluster(TuyaThermostatCluster):
    """Thermostat cluster for Tuya thermostats."""

    #    cluster_id = Thermostat.cluster_id

    def __init__(self, *args, **kwargs):
        """Init."""
        super().__init__(*args, **kwargs)
        self._update_attribute(self.attridx["min_heat_setpoint_limit"], 500)
        self._update_attribute(self.attridx["max_heat_setpoint_limit"], 3000)

this is not working:

 _CONSTANT_ATTRIBUTES = {
        MIN_HEAT_SETPOINT_ATTR: 500,
        MAX_HEAT_SETPOINT_ATTR: 3000,
        CTRL_SEQ_OF_OPER_ATTR: Thermostat.ControlSequenceOfOperation.Heating_Only,  # the device supports heating mode
    }

Do you know of any other/better way of doing this?

PS. Check if this is working correctly for Moes/Beca TRV as those seem to read those values from TRV but, are those values implemented in HA?