Double entity for temperature offset in Controls and Configuration for the Tuya TRV (TS0601 by _TZE200_h4cgnbzg)

Hello together, I need help in order to understand if and how I can correct the following.

I am using the said TRV and for this I use a quirk that I am testing; I hope that I can bring it into the zha_quirks later.
The quirk I am using originally from this repository.

  1. When I do not use the quirk, then no temperature offset shows up, i.e. there is no entity for this.
  2. When I use the quirk, then both show up as in the screen shot below. When I change one slider, the other one gets updated occasionally. However the other gets updated with a wrong value. The offset slider in the controls section has min value -6 and max value +6. The offset slider in the config section has min and max values of -2.5 and +2.5 (with finer step values: 0.1).
  3. When I modify the quirk and remove the temperature offset part, then no temperature offset does not show up, i.e. there is no entity for this.

Image showing two temp offset entity being displayed, one in controls and one in config:

I do not know where to search or find a way to fix this.

I’d like to know if you have a similar experience or an idea how I could go about it. I’d appreciate any help.

Hi, i had the same issue with the calibration / offset slider and a blueprint i’m using. I modified the quirk (trv_saswell.py) a bit to make it work but just be aware i’m just testing this right now and it might not be the best solution :wink:

The first slider from -6 to 6 for the calibration value with step size 1 does only accept int values.
entity: number.<entityname>_nummer_temperature_calibration

The second slider from -2.5 to 2.5 for the offset value with step size 0.1 does accept float values.
entity: number.<entityname>_lokaler_temperatur_offset

What i observed was the AHC (Advanced Heat Control) blueprint was setting the calibartion value for my thermostat to “out of range” and very high values like -25°C (instead the offset of -2.5°C). In the Home Assistant web interface it was always shown as -6 for the slider but only because this is the limit for the slider and not the limit for the values the calibration can be set to.

I modified the quirk code at two points (experimental!):

class SaswellManufCluster (line below commented out original line)

    DIRECT_MAPPED_ATTRS = {
        SASWELL_ROOM_TEMP_ATTR: ("local_temperature", lambda value: value * 10),
        SASWELL_TARGET_TEMP_ATTR: (
            "occupied_heating_setpoint",
            lambda value: value * 10,
        ),
        #SASWELL_TEMP_CORRECTION_ATTR: ("local_temperature_calibration", None),
        SASWELL_TEMP_CORRECTION_ATTR: ("local_temperature_calibration", lambda value: round(value * 10)),
    }

class SaswellThermostatCluster (line below commented out original line)

    DIRECT_MAPPING_ATTRS = {
        "local_temperature_calibration": (
            SASWELL_TEMP_CORRECTION_ATTR,
            #lambda value: value,
            lambda value: round(value / 10),
        ),
        "occupied_heating_setpoint": (
            SASWELL_TARGET_TEMP_ATTR,
            lambda value: round(value / 10),
        ),
    }

With this modification the calibration value of the thermostat is always corrected and rounded and vice versa for the offset value. So both sliders match and are in the limits of the thermostats calibration range.

I had to multiply and divide by 10 because otherwise the values do not match up. I don’t completely understand whats wrong here (or just caused by the blueprint) i just “fixed” (i’m not familiar with coding for home assistant) the problem for me :slight_smile: So please take this with some precausion it might break things (or not). I have to see if this modification does the job for me or not.

1 Like

Thank you for your reply, nice analysis.

I just updated Home Assistant and noticed there are a few more configurations for the thermostat now, e.g. Max Temp and Firmware.
Also there are a few more Diagnosis elements too.

My guess is that there is work in progress in regards to (Tuya) devices.

The configuration for the temperature offset could be the range that the entity for the calibration should use maybe. I guess it is not done yet and there might come more changes with the next updates.

1 Like