Need some help on icons and colors

this worked before, my costomize.yaml file:

binary_sensor.water:
  friendly_name: Warm water
  templates:
    icon: if (state === 'on') return 'mdi:water'; else return 'mdi:water';
    icon_color: if (state === 'on') return 'rgb(255, 0, 0)'; else return 'rgb(65, 65, 94)';
binary_sensor.vlam:
  friendly_name: Vlam status
  templates:
    icon: if (state === 'on') return 'mdi:fire'; else return 'mdi:fire';
    icon_color: if (state === 'on') return 'rgb(255, 0, 0)'; else return 'rgb(65, 65, 94)';
binary_sensor.verwarming:
  friendly_name: Verwarming status
  templates:
    icon: if (state === 'on') return 'mdi:radiator'; else return 'mdi:radiator-off';
    icon_color: if (state === 'on') return 'rgb(255, 0, 0)'; else return 'rgb(65, 65, 94)';
sensor.woonkamertemp:
  friendly_name: woonkamer

only when the flame is on the icon changes, labels are shown correct

afbeelding

when all is in rest the wrong icon for the flame is shown:

afbeelding

Then you are using some type of custom integration because that is not valid YAML for home assistant customization.

1 Like

Do you have:
Mariusthvdb/custom-ui: Adapted Custom-ui for HA 110+ (github.com)
here?

I don’t understand:

    icon: if (state === 'on') return 'mdi:water'; else return 'mdi:water';

Why not just:

    icon: mdi:water
1 Like

correct, forgot about that one.

i feel so stupid now that i missed the custom ui not being loaded… fixed!

and for the water icon, i was searching for an other icon like a crane. work in progress from 1 year ago…

afbeelding