Color of the state

Hello together,

unfortunately I can’t do this alone so I hope You can help me.
I want to do a list with the temperatures and humidity of the rooms. Also I would like to have, when the humidity go above (for example) 60%, the number will be orange and above 70% red.
How You can see on the screenshoot, change the colour isn’t a problem but with “if” I do something wrong but what?


type: entities
entities:
  - entity: sensor.temperatur_aussen_temperature
    type: custom:multiple-entity-row
    name: Außen
    secondary_info: last-changed
    show_state: false
    entities:
      - sensor.temperatur_aussen_temperature
      - entity: sensor.temperatur_aussen_humidity
        styles:
          color: >-
            [[[ if (states["sensor.temperatur_aussen_humidity"].state != "0")
            return "blue"; else return "red"]]]
  - entity: sensor.wandthermostat_temperature_2
    type: custom:multiple-entity-row
    name: Flur unten
    secondary_info: last-changed
    show_state: false
    entities:
      - entity: sensor.wandthermostat_temperature_2
        styles:
          color: red
      - entity: sensor.wandthermostat_humidity_2
        styles: >-
          {% if is_state('sensor.wandthermostat_humidity_2') >= "60") %}
          color: orange
          {% if is_state('sensor.wandthermostat_humidity_2') >= "70") %}
          color: red
          {% else %}
          color: green
          {% endif %}

Thank You,
kamil

1 Like