Fix passive zone lookup in zone-only location privacy mode#4385
Merged
bgoncal merged 2 commits intohome-assistant:mainfrom Feb 24, 2026
Merged
Fix passive zone lookup in zone-only location privacy mode#4385bgoncal merged 2 commits intohome-assistant:mainfrom
bgoncal merged 2 commits intohome-assistant:mainfrom
Conversation
In zone-only mode, SubmitLocation derives the current zone by GPS lookup via RLMZone.zone(of:in:). That method was filtering with trackablePredicate (TrackingEnabled == true && isPassive == false), which caused passive zones to never be reported when the user is inside one - sending "not_home" to HA instead and breaking automations that trigger on entering a passive zone. Fix by using only the TrackingEnabled filter in zone(of:in:), which is purely a GPS-to-zone lookup and has no reason to exclude passive zones.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes zone-only location privacy mode so passive zones are correctly resolved client-side during GPS-to-zone lookup, preventing not_home payloads when inside a passive zone.
Changes:
- Updates
RLMZone.zone(of:in:)to filter only onTrackingEnabled == true, allowing passive zones to be returned. - Leaves
trackablePredicateunchanged for existing usages (e.g., GeocoderSensor) where passive zones should remain excluded.
Covers the two cases affected by the fix: - Passive zone with TrackingEnabled = true is returned when the location is inside it - Zone with TrackingEnabled = false is still excluded
bgoncal
approved these changes
Feb 24, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4385 +/- ##
======================================
Coverage ? 0
======================================
Files ? 0
Lines ? 0
Branches ? 0
======================================
Hits ? 0
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
When the Location Sent setting is set to Zone Only, automations that trigger on entering a passive zone stop working while the same automations work correctly with Exact location.
Root cause
In zone-only mode,
SubmitLocationderives the current zone by GPS lookup viaRLMZone.zone(of:in:)rather than using the zone associated with the incoming region event (the event zone may be the one being exited, so a fresh lookup is needed). That lookup filtered usingtrackablePredicate:The
isPassive == falsecondition meant that when the device was inside a passive zone, the lookup returnednil, causing the payload to reportnot_hometo Home Assistant instead of the passive zone so no automation triggered.In Exact mode this doesn't occur because raw GPS coordinates are sent and Home Assistant resolves the zone server-side, where passive zones are handled correctly.
Note that passive zones are monitored for region enter/exit events by the iOS app (
ZoneManagerfilters only onTrackingEnabled, notisPassive), so the region event does fire, the zone is simply lost during the zone-only lookup step.Fix
Remove
isPassive == falsefrom the filter inRLMZone.zone(of:in:), replacingtrackablePredicatewith aTrackingEnabled == true-only filter. This method performs a GPS-to-zone lookup and has no reason to exclude passive zones.trackablePredicateis left unchanged and continues to be used correctly inGeocoderSensor.