home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.18k stars 30.2k forks source link

Solve overlapping zones #114837

Closed crazyserver closed 2 months ago

crazyserver commented 6 months ago

The problem

When defining zones in HA, you can have multiple overlaping zones.

In the current solution, the person sensor enters to the first zone found in system (home is the last always). The location of this person will be this zone. To fix this a priority should be defined.

Also, the zone sensor only counts people on one of the zones, and if a person is in multiple zones at the same time, only is counted in the first. I would fix this counting on all the zones the person is in.

To reproduce this, create multiple zones that overlap between them and check with GPS location how it behaves.

What version of Home Assistant Core has the issue?

core-2024.4.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

zone

Link to integration documentation on our website

https://www.home-assistant.io/integrations/zone/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 6 months ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (zone) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zone` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zone` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zone documentation zone source (message by IssueLinks)

mcmanigle commented 5 months ago

I agree that "overlapping zones" is something worth addressing, as it seems to come up a lot.

Adding zone priority seems like a reasonable way to avoid a breaking change while adding functionality (though also adding complexity to the zone concept).

Adding person counts to additional zone sensors, while completely logical, is breaking, and therefore seems like a bigger lift.

I wonder if the same result could be achieved in a non-breaking manner by adding a new attribute to zones (listing all people within, including those who are in the zone but the zone is not "their primary zone" or whatever you want to call it), and to people and device trackers (listing all zones they are in).

That would be a way that end users could rely on overlapping zones in automations without breaking the "zone counters," even if the current behavior is problematic.

As a mental model for this sort of thing, examples I have seen recently are:

  1. an "at the library" zone that overlaps with "on the university campus" zone
  2. an "areas the nanny should be" zone that overlaps with a "home" zone
  3. similarly, a "close to home" zone concentric with the "home" zone
  4. trying to think of overlapping-but-not-coincident, maybe a "shopping district" zone and a "downtown" zone with areas of each that are outside the other
issue-triage-workflows[bot] commented 2 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.