I’ve some ‘state-labels’ I want to change the color from, based on state.
For example:
The temperatures (state-labels) are displayed, and I can change the colour also in raw-editor.
But I want them to change them (not the names, the values) automatically, based on the state values HA gets.
For state-icons, this works like a charm (I have Custom UI):
sensor.temperature:
friendly_name: Temp
templates:
icon_color: >
if (state < 2) return 'darkblue';
if (state < 7) return 'dodgerblue';
if (state < 15) return 'lightblue';
if (state < 19) return 'lightgreen';
if (state < 22) return 'green';
if (state < 23) return 'darkgreen';
if (state < 30) return 'orange';
if (state < 40) return 'red';
return 'firebrick';
To get my icons changing colour based on the different states.
I did try a lot of things by changing ‘icon-color’:
text-color, label-color, label-text-color,… But nothing seems to work.