Sonoff TRVZB, zigbee2MQTT and BetterThermostat

Hi!

As the next step of home automation I want to add “smart thermostat” which should be controlled by HA.
I got Sonoff TRVZB which is connected via zigbee2mqtt to home assistant 2024.2.1. Also I am using an external zigbee temperatur sensor.

My goals for the first step are quite simple:

  1. If I set the target temperature in home assistant, thermostat needs to be on as long as this temperature is not reached
  2. If I change the temperature on the thermostat itself, it should be transfered to HA (in other words: I want to controll the temperature via home assistant and hardware at the same time)

Maybe I was/am a little bit unsophisticated, but what I did was:

  1. Install thermostat
  2. Pair it with zigbee2mqtt
  3. Configure “Better Thermostat” component

At first it looked like everything is OK, in reallity there are major problems I can’t wrap my head around:

  1. Status is not in sync: better thermostat is showing, that the thermostat is heating, but “running_state” is idle and the heater is off (still warm, yes, but not heating). Or the other way around: running_state is heat, but according to better thermpostat the heater is off.
  2. Temperature is not in sync: when I change the temperature of the thermostat itself, sometimes it get updated in better thermostat component, sometimes not. The normal entity for the thermostat seems to have been updated.
  3. Sometimes the target temperature magically jumps to 35 without any interactions. I enabled the debug logs, but I can’t see why it’s happening:
... no entries for several minutes ...
2024-02-24 17:42:51.876 DEBUG (MainThread) [custom_components.better_thermostat.climate] better_thermostat Wohnzimmer Thermostatsteuerung: HA set target temperature to 20.5 & None
2024-02-24 17:42:51.877 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Wohnzimmer Thermostatsteuerung: TO TRV set_temperature: climate.thermostat_wohnzimmer from: 29.0 to: 28.5
2024-02-24 17:42:51.884 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Wohnzimmer Thermostatsteuerung: climate.thermostat_wohnzimmer / check_target_temp / _last: 28.5 - _current: 29.0
2024-02-24 17:42:53.233 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer update received
2024-02-24 17:42:53.233 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: trigger_trv_change / _old_heating_setpoint: 29.0 - _new_heating_setpoint: 28.5 - _last_temperature: 31.0
2024-02-24 17:42:53.233 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer decoded TRV target temp changed from 23.0 to 28.5
2024-02-24 17:42:53.233 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Wohnzimmer Thermostatsteuerung: TO TRV set_temperature: climate.thermostat_wohnzimmer from: 31.0 to: 35.0
2024-02-24 17:42:53.237 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Wohnzimmer Thermostatsteuerung: climate.thermostat_wohnzimmer / check_target_temp / _last: 35.0 - _current: 28.5
2024-02-24 17:42:53.526 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer update received
2024-02-24 17:42:55.865 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer update received
2024-02-24 17:42:55.865 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer sends new internal temperature from 28.5 to 28.1
2024-02-24 17:42:55.865 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: trigger_trv_change / _old_heating_setpoint: 35.0 - _new_heating_setpoint: 35.0 - _last_temperature: 28.5
2024-02-24 17:42:55.866 DEBUG (MainThread) [custom_components.better_thermostat.utils.controlling] better_thermostat Wohnzimmer Thermostatsteuerung: TO TRV set_temperature: climate.thermostat_wohnzimmer from: 28.5 to: 28.5
2024-02-24 17:42:56.238 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer update received
2024-02-24 17:42:56.238 DEBUG (MainThread) [custom_components.better_thermostat.events.trv] better_thermostat Wohnzimmer Thermostatsteuerung: TRV climate.thermostat_wohnzimmer sends new internal temperature from 28.5 to 28.1
... no entries for several minutes ...

For Better Thermostat advanced config I have tried following combinations:

  1. Calibration type: Offset Based. Calibration mode: AI Time Based
  2. Calibration type: Target Temperature Based. Calibration mode: Normal

None of them solved any issues.

I can’t imagine, that I am the only one person who experience such problems, and I don’t do tricky stuff. But however, I was not able to find any infos on this topic, so I decided to create a new post for this.

What am I doing wrong? Smart thermostat is quite useless in this state as it is pure gamble if and when it works.

In case you need any further information (config, screenshots, whatever), please let me know.

Hi DerXHelp,

to begin with, I can’t offer you a solution right now. I just wanted to ask whether you already figured out a solution by yourself?
Got the same TRVs and I am encountering similar problems, the Sonoffs are behaving quite weirdly. Heating (or at least not shutting off) when an open door is detected etc.

@DerXHelp @orangered

I have six Sonoff TRVZB and they have mostly been behaving themselves. I’m also running Zigbee2MQTT and Better Thermostat.

I had seen similar issues to what you describe with Better Thermostat (jumping to 35C) and the solution for me was to update to the beta versions which appear to contain a bug fix. Ran 1.5.0 beta 6 for quite a while and latterly beta 7, so I would give them a go. If you are on 1.4, I would suggest updating and reading the issues on Github for more info.

Mine were stable and working well for weeks thenn last week I did an OTA firmware update for the TRVs which broke everything. I had an issue where they appeared to lose the valve calibration and the only way I could recover it was by doing a factor reset. Then I think doing that broke better thermostat and for some reason meant that the external temp sensors got stuck (i.e. fixed at a value) which broke the logic. Just noticed this and re-configured all my BT Thermostats via the configuration menu and this appears to have unstuck them. Will have to see if all is now well.

I’ve also migrated from ZHA to Z2M (not specifically for these devices) and the support in Z2M seems much better.

1 Like