Is there anyway to automate the adding of lights to groups based on the name of the light and area?

Hello all,

Is there anyway to tackle the subject.

Essentially when I add a light to my system, it is usually very descriptive. For example, “Master Bedroom Accent Light”, I then assign it to the room manually.

Is there anyway to automate which groups this light then becomes a part of, rather than having to go through and add it to one group at a time?

Are there any other parts of this process I can automate?

Another thought is an entity that has the word “water sensor”, “door sensor” in it. Have it automatically be part of the group of water sensors/ door sensors that other automations etc. then work off of.

Thank you all for your thoughts on this situation. I am relatively new to home assistant and trying to wrap my ahead around best practices.

It depends on what kind of “groups” you mean.

  • A legacy group, the kind whose domain is group as in group.exterior_doors, has actions to set and remove groups members (so it can be automated).

  • A modern group has no actions so you can’t automate the addition/subtraction of group members. A modern group of binary sensors will have a binary_sensor domain such as binary_sensor.exterior_doors.

Ahh, I follow you here. Thank you for your response @123

Do you believe the legacy group will eventually cease to exist? or it’s hard to say-- or maybe even, probably not.

1 Like

I doubt it will be removed because it’s still useful (especially if you want to automate the process of creating one). It may become less useful if they ever add equivalent actions to the modern group.