Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95493

Another 'Icon color change based on state' question

$
0
0

@coen17st wrote:

I have been trying for some time to figure out how I can make an icon color change based on the state. I see that there are a lot of topics about this, but none of them offers me results and the topics date from 2017/2018 so I doubt that those are the right methods.

So i want to change the icon and icon color based on state, the icon change succeeded but the color did not. i have te following setup:


sensor:
  - platform: template
  sensors:
      voordeur:
      value_template: '{% if is_state("binary_sensor.aeon_labs_zw089_recessed_door_sensor_gen5_sensor", "on") %}Open{% else %}Dicht{% endif %}'
      friendly_name: 'Voordeur'
      icon_template: >-
          {% if is_state('sensor.voordeur', 'Open') %}
          mdi:lock-open-variant-outline
          {% else %}
          mdi:lock
          {% endif %}

customize:
  sensor.voordeur:
    templates:
        icon_color: >
        if (state === 'Open') return [143,29,29];
        return [45,133,58];

Capture
open

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95493

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>