Colour for sensor entity icons not honoured

I am using the [hue, saturation] key pair to define icon types and colour depending on entity state. The icons are displaying correctly but the colour is not. Any ideas?

customize.yaml:

binary_sensor.thermostat_kitchen_programme_mode:
  templates:
    icon: >
      if (state == 'on') {
        return mdi:check-outline; 
      } else {
        return mdi:checkbox-blank-circle-outline;
      }       
    # On=green Off=red
    rgb_color: >
      if (state == 'on') {
        return [130,100]; 
      } else {
        return [0,100];
      }

hue=130, saturation=100 should be green
hue=0, saturation=100 should be red.

?

Hi, probably rgb_color is for RGB coded values (red, green, blue) and not for hue saturation coded values. So, try [255, 0, 0] for red and [0, 255, 0] for green instead.

Just a guess…

This is in your main Home Assistant customize file at /config/customize.yaml?

nope, HA core used to use RGB but now HA uses hue and sat key pairs.

yea , they are.

I was going to let you know that none of that is valid in customize.yaml (templates, javascript) and I didn’t understand how the icon value could possible be working. Then it dawned on me you’re might still using custom ui. Been so long for me I’d almost forgotten it was ever a thing. If you’re not, the only way to set icon colors dynamically is in the front end. Here is a more recent relevant thread that discusses it. Templates are not allowed in customize.yaml.

As for your color issue rgb values are very specifically a dictionary or list of 3 integer values between 0 and 255. I think you might be looking for the hs_color parameter.

nope, none of that you mention is actually the case.
Documentation doesn’t align with functionality.
I’ve moved on from this now so gave up in the end.

unwatching this thread.