Hello all!
I’m new to the community. Got started when I saw some other floorplans around.
I’ve been trying to tinker as I’m learning, but I am stumped. I’ve tried various Google searches, and reading through forum posts, but I just can’t find my answer. I’m sure this is fairly basic HA/answered a thousand times.
I’ve set up my floorplan, and drew a custom svg shape over my living room. I was able to assign a light to it (e.g. light.living_room_1).
However, we have 3 lights in that room (e.g. light.living_room_1, light.living_room_2, and light.living_room_3), and I want all lights to turn on/off when I click the room.
I’ve figured out how to group lights so that they show up in dev-state as “group.living_room_lights”, so I assumed that I could use that as my ID in Inkscape for the living room shape, but that doesn’t seem to be clickable on HA.
Help would be greatly appreciated! I’m loving this project and community so far!
Well, I’ve sort of got it working… but then it introduced another “bug.”
I used a script to allow me to turn on multiple lights at once, and then used the script.living_room_lights as my ID in Inkscape. But because it’s a Script, I guess it doesn’t have an on/off state. It just toggles the lights on or off depending on what their state is. So now the on/off css doesn’t show up properly.
Thanks to some help on the Home Assistant Discord channel (AtomicPapa), I’ve now got it working as desired.
I’ll write a sample of the code here for anyone who may stumble on this with the same request.
Essentially what I had to do was:
set up an input boolean to determine the state of the room (lights on or lights off).
set up two scripts, one to turn all of the lights in that room on and the second to turn all of the lights off.
set up two automations, one to listen for the input boolean to be on so that the script for lights on would be fired. And the second to listen for the input boolean to be off so that the script for the lights to be turned off would be fired.
change my SVG ID to be the input_boolean.
.
.
===== configuration.yaml =====
input_boolean:
living_room_lights_status:
name: Current Status of Living Room Lights
initial: off
icon: mdi:light
As mentioned above, make sure to set up the SVG ID of your room (or your entity) as your input_boolean. So in this case it would be input_boolean.living_room_lights_status