Hi everyone.
I have tried to change the icon color of an entity (in this case a sensor created in template.yaml), writting this in customize.yaml
sensor.prueba:
friendly_name: PRUEBA
templates:
icon_color: >
if (state < 'input_number.referencia_prueba') return 'yellow';
if (state > 'input_number.referencia_prueba') return 'orange';
The purpose is…
…comparing the entity sensor.prueba with the state of the numeric entity input_number.referencia_prueba.
…If sensor.prueba is above input_number.referencia_prueba, then the color of the icon of sensor.prueba has to change to orange
…If sensor.prueba is under input_number.referencia_prueba, then the color of the icon of sensor.prueba has to change to yellow.
With the code y pasted, the icon is always yellow. It doesnt matter if the state of sensor.prueba is above or under the state of input_number.referencia_prueba
Please, anyone who know what I am doing wrong??
Thanks in advance.
CREATING THE ENTITY (SENSOR)
CUSTOMIZING
CHECKING