Can I group lights using (device) area or glob pattern?

Evening folks,

I’ve been looking at the light group integration, and it got me excited about grouping all lights within each area (Bedroom, Kitchen etc.) in my home. Doing this the manual, repetitive, way - as described in the docs - is easy and works just fine.

But… when you have dozens of lights, this becomes a bit tedious. Since Home Assistant already has the concept of areas, would it be possible to create a light group that populates - and keeps up to date - with all lights from a certain area?

Skimming this forum and consulting Google, that doesn’t seem possible?

Another neat trick would be to allow for a glob pattern in a light group, but that doesn’t seem to be possible either?

At the moment area doesn’t do a lot.
It does expose some handles for Google but other than that…
I’m not sure what you mean by dozens of lights, I have 18 lights in my whole home. A list of these (generated by using the template editor) can be copied and pasted into multiple overlapping permutations as you see fit. What are you trying to achieve ?

It’s not too bad at the moment (< 30 lights), but we will move to a house with ~5x the lights in a not too distant future.

I like the idea of using the template editor to quickly extract entities, but I’d love to keep my configuration minimal and not have duplicate information in it unless I absolutely need to. In a perfect™ world, I could move one of my desk lamps to another room, update the light’s corresponding area in HA and have the new + old light groups update automatically.

Another example: buying a new light source, it would be neat to just assign an area to it and have the corresponding light group update automatically.

1 Like

“{{ states.light | map(attribute=‘entity_id’) | list }}”

Your request would not be high on the list of priorities as there are as many cuts as there are users.
a) I want just the 400lm lamps
b) I want the ceiling lights
c) I want the wall lights
d) I want the outside lights at the front of the house

It’s easier just to create groups and move the entiies between them
One solution that fits all cases

I can’t remember who gave me the format for this expression (probably Taras) so … “I made this !” :rofl:

Yeah - the light group functionality covers all cases and works perfectly fine - just a bit sad that I can’t re-use an existing concept (area) that HA already knows about.

Thanks for the template pointer again - will come in handy in the future :slight_smile:

No, you misunderstand. ‘Area’ is a work in progress, it has only just been implemented and as I said has NO VALUE within HA as of today’s date.
It does expose ‘some’ handles for other things though.
IF you want to rename ALL your lights you 'could concievably get your concept to work.
eg use a template to find all lights containing (say) a “400lm” string but every time you move stuf you’d have to change the id’s and all the automations and scripts where the old id was used (a VERY bad idea)

Edit: you either have to wait for ‘Area’ to be developed (or do it yourself) OR you can do what the rest of us do and work with the tools that are available to you.

If I get inpatient enough I might just try to find some time to help out, but this is low on my prio list too. Looking forward to see how the area concept develops though.

Sorry to bump an old topic but I was curious @usrlocal . Were you actually able to solve this :slight_smile: ? Area’s are now better but I’m still unable to create a template for(for example) all lights which are on in a specific area without creating a custom group.

I didn’t look into this again, sorry :frowning_face:

1 Like