Tile card - show meaningful text instead of sensor number values

Hi,
I have a sensor that can have four distinct values (0,1,2,3).
I want to show this information on my dashboard using a Tile card. However, instead of the numbers, I would like to display what they actually represent.

E.g. 0=off, 1=standby, 2=running, 3=problem

Is this possible?

template sensor

As Ildar says create a helper template sensor and add this yaml:

{{ ["Off", "Standby", "Running", "Problem"][states('sensor.your_sensor_with_numbers')] }}
1 Like

Thanks both for your feedback.
I was hoping for a solution in the card itself, but I created a template sensor as suggested:

{% if is_state('sensor.sauna_status', '0') %}
            Uitgeschakeld
          {% elif is_state('sensor.sauna_status', '1')%}
            Stand-by
          {% elif is_state('sensor.sauna_status', '2') %}
            Opwarmen
          {% elif is_state('sensor.sauna_status', '3') %}
            Fout!
          {% else %}
            Fout!
          {% endif %}

@Hellis81 , I tried your code first, but that did not seem to work although it looks more simple than my code.

Try it in developer tools, what error does it show?

It says “‘list object’ has no attribute ‘2’”

{{ ["Off", "Standby", "Running", "Problem"]states('sensor.your_sensor_with_numbers')|int(default=0)] }}
1 Like

That works, thanks!

I noticed a small typo, a missing “[” before states.

{{ ["Off", "Standby", "Running", "Problem"][states('sensor.sauna_status')|int(default=0)] }}

I would suggest you not to mark my post as a solution since my post was merely a small correction.

1 Like