I got a few zwave power socket switches (neo coolcam), and I’ve created special state sensor because these switches should always stay on and I dont want to turn them off by mistake (fridge, freezer etc).
however, in my lovelace glancecard for these entities the icons stay blue instead of the configured yellow for the state on.
For test purposes I tried to show the yellow coloured icon if the state of the sensor is ‘off’ but also then the color stays blue.
Any thoughts on what might be wrong?
If I use the actual switches that to color changes to yellow proberly, only for these sensors it seems to fail.
I also use rgb templates for icons and they mostly work in Lovelace, however I think that in some cards they don’t seem to work. I haven’t investigated further.
some time ago rgb_color was disabled and changed into icon_color for customizations. Note, this was before Lovelace, so maybe not up to date, bit still, you might try this:
@teachingbirds it not a card issue. the normal switches (also with custom icon and rgb color works just fine). @Mariusthvdb I will try it for sure! thanks for the suggestion. One thing though, I found another topic where you mentioned that for template_sensors (which I try to change) I have to set the color in the declaration of the entity itself? I can’t find any reference though about the correct syntax.
I tried extending my template sensor with icon color like this:
but icon_color is not accepted there. (also tried color names instead of rgb values but also no luck).
I keep finding it strange that a global customize icon does work for template_sensors, but the color doesn’t, while it does work for the actual switches.
edit: and rgb_color is actually still working as well but I changed it to icon_color for future updates.
No, what I tried to say was that if you use a template sensor, you need to set available options/customizations in that sensor definition (and not in customize section)
icon_color is not one of them, so if you want that, you need to set it in customize, but you can only do so after having installed custom-ui and use the template I provided.
please not the difference in syntax between the 2.
ok, got it. I did find the mentioning of custom-ui and I do not have it installed yet, but as you mentioned, lovelace is completely separated from custom-ui so installing it will not help me in my case?
And still, in global customize I cán set the icon for all my state sensors, and I cán set the icon ánd icon_color for my normal switches (without having installed custom-ui)
It’s a bit unclear to me what should work out of the box and what not, but I will try to find out how to set the icon colors in lovelace itself.
edit: hmm correcting, disabling rgb_color for switch.* does nothing. I guess for switches the on off icon_color changes are part of HA code.
If you want anything else than the regular colors, you’d need to customize it. Maybe best to see first if you like the built in front-end presentation of HA and if needed, add customization. the green and red of your example are not standard.
I do like the built in front-end presentation of HA, but noticed that sensors with on/off states don’t change color, that’s why I try changing the colors for those icons.
as you can see I use the available options of the template sensor in the sensor declaration itself, and customize its icon_color separately, which you can do using any CSS color code.
I have only imported my setup though the import tool and little to no experience with Lovelace, but from what I can see, the sensors do take the color I’ve set in custom-ui, so you might be safe there It doesn’t do a lot of other things, like the extra_data_templates, or badges, nor does Lovelace show the Tiles I’ve setup.