I have been trying for some time to figure out how I can make an icon color change based on the state. I see that there are a lot of topics about this, but none of them offers me results and the topics date from 2017/2018 so I doubt that those are the right methods.
So i want to change the icon and icon color based on state, the icon change succeeded but the color did not. i have te following setup:
Would love to know the answer to this as well. Iāve resorted to building my own sensors and using entity_picture_template along with custom MDI icons that I create and then save locally in needed colors. Cumbersome.
Nope, youāre in the same boat as the rest of usā¦
Really seems like it should be built-in functionality - guess itās time for a feature request for icon_color to work in sensors, switches and such - or even just icon_template / icon_color in lovelace would be fine with me - easier there than rebooting to reload updates sensors anyhow.
Ok, sorry to open up this topic again. I cant get something working, probably beginnners levelā¦
I want a simple motion sensor icon to not use the default yellow/blue colors but some others.
I have have been reading and googling the last hour but there is so much information, I went from card_mod to css to customisationā¦ but never another colour of my icons done a lot but this I think must be close to the solution. I have:
That is what I am trying to understand. But there is so much information (also outdated) on this forum and I cannot find a simple way how to do what I want. Thus I end up trying out without knowing what I am doing.
Even with your advice that I greatly appreciate (!) I am not able to understand what I should do where and whyā¦
You said:
But how would I do that? Where would I start to do that per entity? Or is that what 'not you meant? That I canāt do icon colors per entity so that it is use in every entity card in lovelace?
But instead I should so i in a card in lovelace per entity and how?
See where I am struggling (as a non-yet coder)
EDIT: What I do want to avoid is to create a template sensor/thing per entity that I want a different icon colour based on stateā¦
Edit: I am totally lost now where to start properly
EDIT2: I now have a lot more options (Perhaps due to the plugin):
But when I ad thing to this or via yaml, nothing happens with the color in lovelaceā¦
This is what I use in customize.yaml: </s> <s>binary_sensor.pir_motion_sensor_toilet_01:</s> <s> icon: mdi:account</s> <s> templates:</s> <s> icon: mdi:water</s> <s> icon_color: if (state === 'on') return 'rgb(128, 255, 0'; else return 'rgb(255, 0, 127)';</s> <s>
EDIT4: Steep learning curveā¦ not sure what did the trick but got it workingā¦ pfew
As for the Ha customize Ui you show, donāt use that for custom-ui, you can only use that for core customization. So not for icon_color or templates. As I stated in the repo, many of the custom-ui options are no longer supported, and, though displayed in that Ui, are no longer valid.