I have a Tuya thermostat which I have flashed with this great 3rd party firmware https://github.com/klausahrenberg/ThermostatBecaWifi
I now have a thermostat that gives me better control and metrics for the job its doing via MQTT. Currently the thermostat has three settings - off (screen off with underfloor heating relay also off), heating (controlled by home assistant) and and auto (which uses the in built schedule in the thermostat). I would also like to be able to see when the thermostat is idle, but this isn’t currently a metric that comes across in MQTT. I will need to base this on an expression - ‘if current temperature is less than desired temperature then heating else idle’.
The problem I have is knowing where to put this in my configuration. From playing around I have been able to put the correct expression in the action_template section of the config, but it also needs an action_topic else the action_template section appears to be ignored. I can’t set the action_topic to be blank and I cant set it to the default topic else the homeassistant.log fills up with errors trying (I’m assuming) to write my action template result back to the thermostat which it doesn’t like or expect.
I’ve copied the current config for my device below. Could anyone lend a hand or let me know where I’m going wrong?
Thanks.
- platform: mqtt
name: Office Heating
payload_on: "true"
payload_off: "false"
power_command_topic: "homeassistant/office/thermostat/deviceOn"
temperature_command_topic: "homeassistant/office/thermostat/desiredTemperature"
json_attributes_topic: "homeassistant/office/thermostat/state"
current_temperature_topic: "homeassistant/office/thermostat/state"
current_temperature_template: "{{state_attr('climate.office_heating','actualTemperature')}}"
mode_state_topic: "homeassistant/office/thermostat/state"
mode_state_template: >
{% if state_attr('climate.office_heating','deviceOn') != true %}
off
{% elif state_attr('climate.office_heating','manualMode') == true and state_attr('climate.office_heating','deviceOn') == true%}
heat
{% elif state_attr('climate.office_heating','manualMode') != true and state_attr('climate.office_heating','deviceOn') == true%}
auto
{% elif state_attr('climate.office_heating','manualMode') != true and state_attr('climate.office_heating','deviceOn') != true%}
off
{% endif %}
modes:
- "heat"
- "auto"
- "off"
action_topic: "homeassistant/office/thermostat/state"
action_template: >
{% if state_attr('climate.office_heating','current_temperature') >= state_attr('climate.office_heating','desiredTemperature') %}
idle
{% elif state_attr('climate.office_heating','current_temperature') < state_attr('climate.office_heating','desiredTemperature') %}
heating
{% endif %}
min_temp: 5
max_temp: 35
temp_step: 0.5
precision: 0.5
retain: true