Thermostat (Toon) question

Hi All,

for a while now i tried changing the text of the 4 different states from the lovelace thermostat card.
Normally you have:
Auto
Heat
Eco
Cool

Unfortunatly Toon uses 4 different states:
Comfort
Home
Away
Sleep

I understand that for compatibility reasons, the states are named the way they are but i really would like to change the text that is displayed in the card.

I created a sensor with a value template, which works. But now the question, how to implement that into the thermostat lovelace card.

afbeelding

my config:

  • platform: template
    sensors:
    toon_thermostat:
    value_template: >
    {%- if is_state(‘climate.toon_thermostat’,‘cool’) %}
    Slapen
    {%- elif is_state(‘climate.toon_thermostat’,‘eco’) %}
    Weg
    {%- elif is_state(‘climate.toon_thermostat’,‘heat’) %}
    Thuis
    {%- elif is_state(‘climate.toon_thermostat’,‘auto’) %}
    Comfort
    {% else %}
    Handmatig
    {% endif %}

Hi ThePierce,

I put your config in My Home Assistant 0.94.5 sensor.yaml, but I get it not working. Maybe I put the spaces in the lines wrong. I’m getting when validate the script in HA the following message:

Invalid config for [sensor.template]: expected a dictionary for dictionary value @ data[‘sensors’][toon_thermostaat']. Got None expected a dictionary for dictionary value @ data[sensors’][‘value_template’]. Got “{%- if is_state(‘climate.toon_thermostat’,‘cool’) %}\n Slapen\n{%- elif is_state(‘climate.toon_thermostat’,‘eco’) %}\n Weg\n{%- elif is_state(‘climate.toon_thermostat’,‘heat’) %}\n Thuis\n{%- elif is_state(‘climate.toon_thermostat’,‘auto’) %}\n Comfort\n{% else %}\n Handmatig\n{% endif %}”. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.template/

Can you help me out?

Many thanks

If you copied straight from his example, I suspect the reverse quotations are causing the issue. It should have been formatted correctly.

{%- if is_state('climate.toon_thermostat','cool') %}Slapen
{%- elif is_state('climate.toon_thermostat','eco') %}Weg
{%- elif is_state('climate.toon_thermostat','heat') %}Thuis
{%- elif is_state('climate.toon_thermostat','auto') %}Comfort
{% else %}Handmatig{% endif %}

Instead of,

{%- if is_state(‘climate.toon_thermostat’,‘cool’) %}Slapen
{%- elif is_state(‘climate.toon_thermostat’,‘eco’) %}Weg

Using the template editor on your installation can help you get past most errors before implementing into your config.

Many thanks for your reply. It is working now. The stranger thing is I put it to the template editor and it give the right value. So i couldn’t find the issue.But by coping the text hire it could give a problem :grin:.