So far I’ve managed to change the icon color with cardmod, but I would want to change the icon to mdi:transmission-tower-off when the grid is offline.
type: heading
icon: mdi:transmission-tower
heading: RED
heading_style: title
card_mod:
style: |
.content ha-icon {
color:
{% set s = states('binary_sensor.energy_acsources_grid_active') %}
{% if (s == 'off') %} red
{% endif %}
}
So far I’ve tried iterations of the following without success.
icon: >
{% if states['binary_sensor.energy_acsources_grid_active'].state === 'on' %}
mdi:transmission-tower
{% else %}
mdi:transmission-tower-off
{% endif %}
Is there a way?