I’m trying to to change the colour of an icon on my picture elements card based on some states. But the template, whilst works in the Developer Tools doesn’t work in the code. I just get a black or white icon, dependent on which device i’m on. Any ideas?
type: picture-elements
elements:
- type: icon
icon: mdi:spa
tap_action:
action: navigate
navigation_path: /fire-panel/pplants
style:
top: 40%
left: 95%
'--mdc-icon-size': 50px
color: >
{% if (states('sensor.moisture_croton') | int < 90 or
states('sensor.moisture_dracaena1') | int < 90 or
states('sensor.moisture_dracaena2') |int < 70)%}
red
{% else %}
purple
{% endif %}