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

Icon color based on entity numeric state with Mushroom template card

$
0
0

Hi all,
I’m trying to make the icon of a mushroom template card change color based on the numeric state of the entity.
I installed HACS Mushroom cards integration, restarted and, after trying lots of ways described variously on the internet, I wrote this:

type: custom:mushroom-template-card
primary: ""
secondary: ""
entity: sensor.qualita_totale_aria
icon: mdi:weather-dust
icon_color: |-
  {% set q = states('sensor.qualita_totale_aria') | float %} 
  {% if q < 20 %} 
    'blue'  
  {% elif q >= 20 and q < 50 %} 
    'green' 
  {% elif q >= 50 and q < 100 %} 
    'lime' 
  {% elif q >= 100 and q < 150 %} 
    'yellow'
  {% elif q >= 150 and q < 200 %} 
    'orange' 
  {% elif q >= 200 and q < 300 %} 
    'red' 
  {% elif q >= 300 %} 
    'purple' 
  {% else %} 
    'gray' 
  {% endif %}

and got no results.
So I searched for other ways or syntaxes and tryed to apply all the different ones I found, but the icon always remains white in the end.
Anybody with a piece of advice?
Thanks

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 109460

Latest Images

Trending Articles


Telangana Ration Card Online Status Ahara Bhadratha Card Online Status


CalCen


Waves Complete v2019.02.14 Incl Emulator-R2R


[RELEASE THREAD]--_A-Team_--Cricket_Dream_5G


MCGEE, SAMUEL O., DECEASED, OF...


WordPress: Reverse Shell


GPGT - chio bu back from market kym


Ondonga king dragged to court


Justin Guy Ballou, III


Krupt Biography, Death, Songs, Photo, Video



Latest Images

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