I’m new to HA, so I’m sorry if this is something that has been asked previously.
I made a 3D floor plan of my house inside a Picture Elements Card, and each room consist in two layers with lights on and off. In every room I placed a ‘mdi:lightbulb-on-outline’ icon so I can click on it and turn the corresponding light on or off.
The room turns on when the light is on and goes back to dark when the light is off.
The ‘mdi:lightbulb-on-outline’ icon is grey when the light is off and turns yellow when the light is on.
I am trying to replicate the same behavior for my living room, where I have 3 different switches that toggle 3 different lights. I want to be able to toggle all the lights in my living room with just one switch, so I can have my ‘mdi:lightbulb-on-outline’ icon changing color from grey to yellow, as well as my living room image layers switching between dark and illuminated.
Then I added that script inside my Picture Elements Card on my lovelace UI. I changed the script icon to ‘mdi:lightbulb-on-outline’ and the lights turn on and off correctly, but my '‘mdi:lightbulb-on-outline’ remain grey.
I would like to know if there is a way to change the color of the living room icon according to the on / off state, just like in the other rooms of the house.
I think its because a script hasn’t got a state, it is just executed.
Try making a group with your switches and using that group for the switch.
Or you might want to make a template light with each of the switches so they show as lights and the you can make a light group which will appear as a light entity
You may have to restart HA before you create the light group
light:
- platform: switch
name: Living Room Light 1
entity_id: switch.livingroomlights1
- platform: switch
name: Living Room Light 2
entity_id: switch.livingroomlights2
- platform: switch
name: Living Room Light 3
entity_id: switch.livingroomlights3
- platform: group
name: Living Room Lights
entities:
- light.living_room_light_1
- light.living_room_light_2
- light.living_room_light_3
yup, script definitely doesn’t let you know his state, it’s just a one-time run thing and that’s it. That’s why my light-bulb icon doesn’t change from grey to yellow.
I followed your instructions and I was able to create light switches for my living room lights in my configuration.yaml file
I then created a group in my group.yaml file where I added all the light switches of my living room.
I then linked that group as an entity in my picture elements card so that I could toggle it on or off as follow:
But the light-bulb icon color still doesn’t change.
I think that you are right and I should use a template. I read the documentation provided and I am kinda overwehlmed.
I think that “CHANGE THE ICON” is the closest example that I have to follow but I am a bit lost as to how and where to specify the color, since I just need a change of color based on the state of my group.livingroomlights entity and not a change of icon.
Can you please help me out on how to configure this template based on my group name/switches?
Also, another stupid question maybe, but once I have the template laid out, do I have to do something in particular or is it just a matter of intergrating it via raw editor of my picture elements card?