Climate icon template breaks the toggle
sandreialexandru opened this issue · 2 comments
sandreialexandru commented
Which version of Room Card?
1.08.02
Describe the bug
Adding template styles to climate entity icons breaks the toggle of the climate card. Changing the state of the climate is impossible, as it reverts to original state.
Example: If climate is in Heat mode, turning it Off does not persist. After a few seconds it reverts back to Heat.
- entities:
- entity: climate.101_climate
name: Climate
show_name: false
show_state: true
show_icon: true
tap_action:
action: more-info
hold_action:
action: toggle
icon:
template:
styles: >
if (entity.state = "heat") return 'color: red';
if (entity.state = "off") return 'color: grey';
else return 'color: orange';
icon: >
if (entity.state = "heat") return 'mdi:radiator';
if (entity.state = "off") return 'mdi:radiator-off';
else return 'mdi:thermostat';
marcokreeft87 commented
If all you change is color, I would recommend using the conditions.
Because you made a mistake in your template. Single equals sets the value, what you need is == in stead of =
sandreialexandru commented
Great! It works, thank you!
icon:
conditions:
- icon: mdi:radiator-off
condition: equals
value: 'off'
styles:
color: grey
- icon: mdi:radiator
condition: equals
value: heat
styles:
color: red