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

I bought several TRVZB’s in the middle of summer and got them installed but did not have a chance to test them until recently. I ran some small tests when I first bought them, but, it was 30+ degress C so cant say it was a real test :slight_smile:

Now since it is almost winter time here with outside temperatures around 10 degrees in the night, I tried all the combinations with Better Thermostat with no luck on TRVZB, BT is a great tool, just not playing well with TRVZB from my experience.
Let me not say ‘with no luck’. It worked pretty well with two TRV’s, but the other two never worked as intended. All the TRV’s are in the same verions, so I have no idea why such a thing happened.

What I’m using;

  • TRVZB in each room (4 in total) connected via ZHA on Sonoff Zigbee Dongle E
  • Xiaomi BT Thermometers in each room with custom firmware installed
  • 1 Zigbee dry relay to turn Combi Boiler on/off

What I did is, since i do not need to control from the TRV itself, we use Homepod Minis to control the whole house via voice, also mostly automations do the job, i set the offset of the TRV on ZHA to -7 so that it always reads a low value internally, and set the climate entity of the TRV to 35 degress C. (max this TRV supports) This way whenever it is switched on, it tries to heat, does not have make any decisions.

Then I created a generic thermostat, and for the switch I gave the switch entity of the TRVZB and for the room temperatures, the Xiaomi BT thermometers. So what the Generic Thermostat does is, switch on/off the TRVZB. Since (as far as I know) TRVZB is not modulating anyway, it is either on or off, this scenario works pretty good for me.

Also created two automations which read the HVAC_ACTION value of the Generic Thermostats.
If any of them is ‘Heating’, combi boiler is turned on.
If all of them are ‘Idle’ or ‘Off’, combi boiler is turned off.
Btw, the dry relay is connected to the thermostat input of the combi. I don’t have central heating in my apartment so I needed to control the combi as well.

It’s working pretty consistently now, even got the ‘wife approval’ :slight_smile:
I added 0 cold, 0.3 hot tolerence on the Generic Thermostat. Because I want to keep the room in the +0.5 degrees range.

Let’s say the room is set to 23.0 Degrees, When the temperature reaches 23.3, TRV shuts off, but since the radiator is still hot, it heats the room another 0.2-0.3 degrees before becoming too cold.

I have a problem with sonoff trv (zigbeetoMQTT) using better thermostat, if the temperature drops with 0.1 degrees the trv starts heating until the set temperature is reached meaning for 0.1 degrees, how can i change the tolerance to 0.5, the tolerance setting in better thermostat seems not to work. thanks

How do you set the offset please? I’m using the Sonoff TRVZB on ZHA but cannot find that setting. Thanks

EDIT: I found the answer here: Calibrating the temperature offset on a Sonoff TRVZB

Same combo: TRVZBs and BT
The MQTT climate entity shows hvac_action: heating (what the thermostat is actually doing), but BT’s hvac_action is idle and vice versa for the most times.
Completely unusable.