this post was submitted on 25 Jan 2025
21 points (100.0% liked)

homeassistant

12854 readers
3 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 2 years ago
MODERATORS
 

Is there any way to group zones together? I would like to define zones that are not necessarily circular in shape. I can accomplish what I want by overlapping several of them, but I really want to group them together and treat them as one zone. Is this possible?

I suppose I could probably script up a template trigger...

top 12 comments
sorted by: hot top controversial new old
[–] just_another_person 3 points 3 weeks ago* (last edited 3 weeks ago) (2 children)

~~Can you elaborate on what you mean? Circular?~~

Nvm, you're talking about the map. A zone is just a logical group, like areas. If you want an automation that runs on bot zones, just make both zones the target. Otherwise just use areas and not zones and group your devices like that, or with a group of devices.

[–] [email protected] 2 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

Like when you create a zone, it's a circle. It has a radius. I want a zone that is an arbitrary shape, so I compose it out of several smaller zones. I want to formally make it a single zone in Home Assistant by grouping them. Currently you can't add zones to groups or create a zone with type: group or anything like that.

[–] just_another_person 2 points 3 weeks ago (1 children)

So I think you're just confused about the organization names. Let me try to clarify:

  • Zone: geographic region, like house1, house 2, office...etc
  • Area: room in a house
  • Group: just a grouping of devices

These are all simply just representative logical units, and can be whatever you want them to be. An area can be a whole house, or it can be a room in a house, or maybe just a closet in a room. Whatever you assign to that group is then used for triggers:

"Turn on all lights in bedroom"

"Turn off all kitchen lights"

Say you have 12 lights in a garage, you want to separate them into groups. You create a group called "garage-lights-1", and assign half to that, then another for "garage-lights-2", and the others there. You can then just create an automation for either group, OR also assign each group to an area called "Garage" if you intend to turn them all on or off at the same time, or create scenes that do different things with different lights. Any entity in HA can be apart of many groups at the same time since it's just a logical thing to help with organizations.

[–] [email protected] 2 points 3 weeks ago (1 children)

I am pretty sure I'm not confused. I want to group zones together so they can be used in automation triggers and I can change the group's membership and not have to change every automation trigger. The group's state should indicate the number of person entities that were in any zone in the group.

I'm not talking about areas at all.

Just to be clear, I don't believe grouping zones is currently possible. It's just a want I have.

[–] just_another_person 2 points 3 weeks ago (1 children)

Well zones pretty much exist to not be grouped. That's their organization function, and why I'm confused about what you're asking.

Why don't you just explain exactly what you need to accomplish, and then maybe we can help you.

[–] [email protected] 1 points 3 weeks ago (1 children)

I...honestly thought I just did that. I want to have an irregularly-shaped zone. I don't see why they couldn't logically be grouped, you just aren't able to do it right now.

Anyway, thanks for reading what I typed.

[–] [email protected] 2 points 3 weeks ago

I think they meant explain the root issue like "I want automation X to trigger if I'm at my cool neighbor's houses but not if I'm at my lame neighbor's houses" rather than focusing on your specific train of thought on how to solve said issue.

[–] [email protected] 1 points 3 weeks ago (1 children)

You don't get the choice to use more than one zone as your official "home" zone though, do you?

[–] just_another_person 1 points 3 weeks ago

It's just an organizational name. You don't even need to actually use zones at all I don't think. Zones are basically used if you have more than one setup across many geographic locations.

Can you explain a bit more about what you're trying to accomplish?

[–] [email protected] 1 points 3 weeks ago (1 children)

I get what you mean and yea I don't think you can easily use groups for that.
Zones have a several things going on.
In no particular order:

  1. A zone's state is the number of people in it.
  2. Zones can be used as enter/leave triggers in automations.
  3. A person's state becomes the name of the zone when they're in them.

Making a mock entity for #1 is easy enough, a helper number thing whose state is the sum of the group members' states.
The other stuff is more complicated.
#2... Might be easier to add the different zones as multiple triggers, which might be a pain to manage. But then, I assume you'd also want to ignore whenever someone moves between zones in that same group.
#3... idk, if it's just for displaying purposes in that person's "badge" thing, just use the same display name for all zones in group. If it's for use in an automation, then you probably need to duplicate everything again.

Might be easier to implement polygonal zones than group normal ones.

I think nodered might already have that geofencing feature.

There's a bit of discussion in here: https://github.com/home-assistant/architecture/discussions/1014

[–] [email protected] 1 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

A person's state becomes the name of the zone when they're in them.

In the current version of Home Assistant, if a person is in two overlapping zones, what happens? It's possible to be in that state today.

I suppose it doesn't really matter though. I've named all my home zones similarly: home1, home2, etc. It would be easy enough to check for a zone where the object_id starts with "home"

[–] [email protected] 1 points 3 weeks ago

Good question, I'd guess it would be the closest to the center of whichever zone.
I haven't tested them, but if they work, it'd be easier to use non circular zones than deal with multiple overlapping ones.