Files
iOS/Sources/Shared/API/Models
Matthias 4a7fd46d67 Fix passive zone lookup in zone-only location privacy mode (#4385)
## 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, `SubmitLocation` derives the current zone by GPS
lookup via `RLMZone.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 using
`trackablePredicate`:

```swift
.init(format: "TrackingEnabled == true && isPassive == false")
```

The `isPassive == false` condition meant that when the device was inside
a passive zone, the lookup returned `nil`, causing the payload to report
`not_home` to 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 (`ZoneManager` filters only on `TrackingEnabled`, not
`isPassive`), so the region event does fire, the zone is simply lost
during the zone-only lookup step.

## Fix

Remove `isPassive == false` from the filter in `RLMZone.zone(of:in:)`,
replacing `trackablePredicate` with a `TrackingEnabled == true`-only
filter. This method performs a GPS-to-zone lookup and has no reason to
exclude passive zones.

`trackablePredicate` is left unchanged and continues to be used
correctly in `GeocoderSensor`.
2026-02-24 10:47:38 +01:00
..