I’m not sure where I’m going wrong of if this is a bug. Using this code:
type: entity
entity: sensor.spare_power_from_powerwall
name: Excess Power
card_mod:
style: |-
ha-card {
--primary-text-color: black;
--secondary-text-color: black;
--ha-card-background: {{ 'red' if ((states('sensor.spare_power_from_powerwall')|float) == 0)else 'green'}};
--card-mod-icon: {{ 'mdi:battery-low' if ((states('sensor.spare_power_from_powerwall')|float) == 0)else 'mdi:battery-high'}};
--card-mod-icon-color: black;
color: black;
}
I get the expected displayed card on my PC but when using the iPhone app or Android app the icon is blue and not black (as it is on the PC).
If I use this code:
type: entity
entity: sensor.spare_power_from_powerwall
name: Excess Power
card_mod:
style: |-
ha-card {
--primary-text-color: black;
--secondary-text-color: black;
--ha-card-background: green;
--card-mod-icon: mdi:battery-high;
--card-mod-icon-color: black;
color: black;
}
Everything is displayed correctly. Anytime I introduce a template it always shows the icon as blue - the template behaves correctly! Any ideas??