Simple output in dashboard

Hi there,

I have a binary sensor which query the operational state from a heatpump as integer (see below)
After I failed to visualize these values with lovelace in a button-card (sorry, for me the configuration is too time consuming) is there a simplier way for displaying the status text in the dashboard?
The following configuration runs successful in the template editor:

sensor:
 - platform: template
    sensors:
      Statusmeldung_RF180:
        unique_id: rf180_status_wwp_human
        value_template:
        {% set count = states('sensor.rf180_status_wwp')|int %}
         {% if count == 2048 %}
          holiday
         {% elif count == 1024 %}
          locked
         {% elif count == 64 %}
          defrost
         {% elif count == 8 %}
          Le-cycle
         {% elif count == 4 %}
          Running
         {% elif count == 2 %}
          Standby
         {% else %}
          undefined
         {% endif %}

If I would have a simple line of text with the current state in the dashboard, that would be fine for me.

Thanks!
Markus

Markdown card?

  1. You said a “binary” - but the code you posted isn’t for a binary_sensor.
  2. If you have a sensor with some text state - why not to print it in Entities / Entity / etc cards?

Good idea.
I was able to get the expected result with your advice:

{% set count = states('sensor.rf180_status_wwp')|int %}
{% if count == 2048 %}
<center>
<ha-alert alert-type="info">
Ferien
</ha-alert>
</center>
{% elif count == 1024 %}
<ha-alert alert-type="info">
Gesperrt 
</ha-alert>
{% elif count == 64 %}
<ha-alert alert-type="warning">
Abtauzyklus
</ha-alert>
{% elif count == 8 %}
<ha-alert alert-type="warning">
Le-Zyklus
</ha-alert>
{% elif count == 4 %}
<ha-alert alert-type="success">
Betrieb
</ha-alert>
{% elif count == 2 %}
<ha-alert alert-type="info">
Standby
</ha-alert>
{% else %}
<ha-alert alert-type="error">
undefiniert!
</ha-alert>
{% endif %}

For now the output in UI is good enough for this.
Thanks a lot!

Markus

1 Like

Sorry, my bad - that was a typo.
I would love to have the operational state as text instead of the shown numbers, unfortunately I am not able to do this (tried many things, didn’t work) - I am good with the markdown option from @IgorZg
Thanks!

Assume you have a numerical value - which you want to represent as a text like “cool”, “good”, …
There are 2 ways:

  1. Create a template sensor - as you tried to do - then show this sensor whenever you wish to show a text presentation.
  2. Or - only display a text presentation in a particular place of UI like you was advised (markdown, template-entity-row, …) without creating a template sensor. In this case you have to repeat same code “number to text” in all these places.