These are the modes Home Assistant understands (and they’re used for Lovelace’s climate card).
Your value_template has to convert the modes reported by your Eurotronic thermostat into modes understood by Home Assistant.
For example, my thermostat reports its modes using a number. Here is each number mapped to one of Home Assistant’s modes.
0 = auto
1 = heat
2 = cool
4 = off
My thermostat’s configuration is like this:
modes:
- auto
- heat
- cool
- 'off'
mode_state_topic: "premise/thermostat/temperaturemode"
mode_state_template: >-
{% set values = { '0':'auto', '1':'heat', '2':'cool', '4':'off'} %}
{{ values[value] if value in values.keys() else 'off' }}
mode_command_topic: "premise/command/thermostat/temperaturemode"
mode_command_template: >-
{% set values = { 'auto':'0', 'heat':'1', 'cool':'2', 'off':'4'} %}
{{ values[value] if value in values.keys() else '4' }}
You said your thermostat also reports its modes as numbers. However, the problem I see is that the modes you mentioned (normal operation, boost, child protection) don’t have direct equivalents in Home Assistant. Perhaps ‘normal’ can be handled as ‘auto’?
To help you design the template, I will need more information about the thermostat you are using. Is there documentation available for this thermostat describing its operating modes? Do you have examples of its JSON payloads?
System modes, Today I will do some testing which system mode I will receive when I turn on the protection mode by using the keys on the thermostat itself :
Hi
I’ve just updated from 0.89 to 0.93 and the custom component is not working anymore: Integration my_mqtt not found when trying to verify its climate platform.
it is located in /home/homeassistant/.homeassistant/custom_components/my_mqtt and there is one file climate.py as in this post Need help with value_template for MQTT HVAC
and the core.entity_registry is edited with my_mqtt instead of mqtt
is there something I’m missing?
Yes, since version 0.92. custom components require a manifest file which I have not yet created because I’m still using 0.89 on my production server and 0.91 on my test server.
I won’t be upgrading until 0.94 or 0.95 so I won’t be creating and sharing a manifest file for several more weeks. Until then, you can create your own by following the instructions here:
The top right is the standard Lovelace Thermostat card and the top left is a custom Lovelace card called Simple Thermostat. They work with any climate component and not just my custom climate component.
Is there a way to change the else value to a variable instead of a constant?
I’ve tried this but can’t find the correct syntax
{% set values = { ‘0’:‘auto’, ‘1’:‘heat’, ‘2’:‘cool’, ‘4’:‘off’} %}
{{ values[value] if value in values.keys() else {{ states(“sensor.water_kitchen”) }} }}
This works but the 1 line is so much more concise
{% if value in values.key %}
{{ values.item }}
{% else %}
{{ states(“sensor.water_kitchen”) }}
{% endif %}