I have some rgb lights, and when they turn red for example, I want my picture-element image to turn red (from default white) too. Can this be done, perhaps by css filter?
I had gotten bored by the default icons, so I wanted to have the actual light to be seen on my floorplan. What do I add to my code?
Thank you for your reply.
I figured that was the way to go, but how would I implement the dynamic state that is rgb(cct) color? What is the code that I am looking for? I have no prior CSS experience…
I don’t normally use rgb, but try this CSS color resources to get you the rgb values.
If you want true dynamic color based on your input state, you may have to pass in rgb values via template.
I don’t have RGB light, from what I’ve seen, RGB light has rgb_color attribute:
enter this: {{ state_attr(‘light.extended_color_light_4’,‘rgb_color’) }} in the Developer Tools/Template will result in something like: {250,255,120}.
If that’s what you get from Template, next, you’ll need:
This works with image having transparent background. To test, you should see green background with this added to your existing code under style:
background-color: rgb(0,255,0,1)
And this uses Config Template Card to do templating, install from HACS.
You can test this if all the above are true and ready:
Thanks for your reply @JTPublic .
I’ve installed the Config Template Card via HACS, and changed “/local/your image.png” to the “/local/floorplan/base.png”, but then the code you provided gives me no card at all. Just empty nothingness. What should my next move be? Is the code wrong?
Let me give you some more specifics.
Under the couch there is an led strip light. HA calls them light.extended_color_light_4 base.png is the complete floorplan of my apartment couch.png is an empty (transparent) image with only a white line. This white line, when overlaid on top of base.png shows a line around the couch on the floor plan, indicating the led strip is on and in which color (or at least that is the goal here).
I figured an empty.png was necessary to just have a completely transparent overlay when the light is off.
Your sample code gives empty nothingness. A card that exists but nothing is visible. An empty card. Try it yourself!
The code i provided at least gives a card of the floorplan, but still no functioning card.
Please help?
This is the placeholder empty.png for when the light is off. This picture is nothingness, completely transparent.
In the bottom room on base.png you can see a greyish rectangle representing my couch. If you were to overlay couch.png on top of this, you would have a white edge around the couch.
The goal is to change the color of this white edge.
All the images are stored in /www/floorplan/ to keep them together.
Yes, now I see how the base.png was used originally.
Did {{ state_attr(‘light.extended_color_light_4’,‘rgb_color’) }} give something like: {number,number,number}?
This replaces your original code and should give the couch.png a green background regardless light on or off.
If this works, we can take the next step.