Need help on linking HVAC Thermostat with Tasmota Thermostat

Hey all,

I need some advice on how to setup my Sonoff 4CH flashed with custom built Tasmota including the Thermostat, see https://tasmota.github.io/docs/Thermostat/#local-temperature-sensor

Here is what I have:

  • a Sonoff 4CH flashed with custom built tasmota according to the instructions.
  • an Aqara temperature sensor that is linked to my HASS instance using zigbee2mqtt
  • (obviously) HASS instance with a sonoff usb 3.0 dongle for zigbee

What I want to achieve:

Use the Sonoff to regulate the underfloor heating system and open/close the valves. Temperature input should come from the Aqara temperature sensor installed in the room. I want to set the temperature in my HASS instance using a thermostat.

I have taken some inspiration from this and this.

However, I still don\t understand exactly how to set the parameters and how they are passed between HASS and tasmota in this case.

Here is what I have so far

1 climate: 
2   - name: DGHeizungSchlafzimmer
3     unique_id: DGHeizungSchlafzimmer
4     modes:
5          - "off"
6          - "heat"
7     mode_command_topic: "DG/tasmotaHeizungDG/cmnd/THERMOSTATMODESET1"
8     mode_command_template: "{{'1' if value == 'heat' else '0' }}
10    mode_state_topic: "DG/tasmotaHeizungDG/tele/STATE"
11    mode_state_template: "{{'heat' if value_json.POWER1 == 'ON' else 'off'}}
12    current_temperature_topic: "zigbee2mqtt/0x00158d0009ef2135"
13    current_temperature_template: "{{value_json.temperature}}"
14    temperature_command_topic: "DG/tasmotaHeizungDG/cmnd/TEMPTARGETSET1"
15    min_temp: 15
16    max_temp: 25
17    precision: 0.1
18    availability_topic: "DG/tasmotaHeizungDG/tele/LWT"
19    payload_available: Online
20    payload_not_available: Offline

This gives me these two thermostats at HASS which look fine so far:

So here are my questions:

  • What has me confounded is the question of where the ‘magic’ happens, i.e. where the logic happens that compares the target and the actual temperature which each other and then switches on/off. I thought that all of that logic happens at the ‘tasmota level’, i.e. the Sonoff gets passed the target temp and the actual temp and then decides on the best strategy to reach the temperature. But I am not so sure anymore, see below.
  • My plan is to read the temperature from an Aqara sensor via zigbee2mqtt; HASS receives the values. However, the values are never passed on to the tasmota device as you can see below.
  • So now I am not sure if the values actually need to be passed to the tasmota device at all or if it is enough to have them at the HASS instance. However, in the tasmota documentation it says the following:

There are several ways to send the MQTT room temperature. For the development and testing of this driver, a Raspberry Pi with Domoticz and a Z-Wave stick has been used to gather all room temperatures from Z-Wave sensors and send them to the respective Tasmota room thermostats.

  • There is a way to do this via /tasmota/cmnd/MEASUREDTEMPSET 21.3°
  • This actually makes me think that the following should be happening: the HASS thermostat should simply decide to switch on/off the tasmota thermostat based on the temperature differential, the rest should be done at tasmota level.

Am I looking in the right place? How would I transfer the current temperature to the tasmota device? I have managed to do so via http request - can this be done via the thermostat in HASS?

Automation

alias: sensor2shelly
description: Überträgt Sensordaten
trigger:
  - platform: time_pattern
    minutes: /2
condition: []
action:
  - service: mqtt.publish
    data:
      topic: cmnd/badluefter/temptargetset
      payload_template: "{{ (states('sensor.lumi_lumi_weather_humidity_3')|float) + 15}}"
    enabled: false
  - service: mqtt.publish
    data:
      topic: cmnd/badluefter/TEMPMEASUREDSET
      payload_template: "{{ (states('sensor.lumi_lumi_weather_humidity_4')|float) + 0 }}"
    enabled: false
  - service: mqtt.publish
    data:
      topic: cmnd/tasmota_marco/TempMeasuredSet
      payload: "{{ states('sensor.lumi_lumi_weather_temperature_5') }}"

Hey there and thank you - I have made it on my on this far. am sending every 5 minutes and it works like a charm. Yes, I have compiled for sonoff 4ch pro.

description: ""
trigger:
  - platform: time_pattern
    minutes: /5
    hours: /1
condition: []
action:
  - service: mqtt.publish
    data:
      qos: 0
      retain: true
      topic: DG/tasmotaHeizungDG/cmnd/TEMPMEASUREDSET2
      payload_template: "{{ states('sensor.badezimmer_dg_temperature') }}"
mode: single

The only thing that does not work anymore is the climate thermostat at HASS showing the current temperature in the room.
This is transferred like so:

 current_temperature_topic: "zigbee2mqtt/BadOGTemp"
 current_temperature_template: "{{value_json.temperature}}"

Why did you fetch your current temperature via the ‘RESULT’ ‘TEMPMEASUREDSET’ and not directly via the sensor state?

A restart of zigbee2mqtt did the trick for the 2nd problem. All solved now

1 Like