It’s really nice to have the iOS app taking care of location tracking for me, but for a variety of reasons, I’d like it to update only with zone entrances/exits — my family is pretty privacy-conscious and I’m much more comfortable just showing when people are in one of the several zones I’ve set up or are “away.” I’m using v1.5.0, and I have updates unchecked for all except for zones, but the map and location tracker objects are still showing gps coordinates beyond them.
I’ve also noticed that the new location services change has the app using a TON more battery than before. Is there a way to mitigate that?
I don’t know about any special features of the iOS app, but for GPS-based device_trackers in general, the way they work are, they only know when a device is in a zone by first knowing their GPS location, and then comparing that to the known zone locations to determine if the device is in a zone.
It might be possible, though, to modify the way the device_tracker component level code works to add a feature that hides the GPS coordinates (i.e., doesn’t expose them as device_tracker entity attributes) until the device is in a zone. Or maybe a feature that just outright always hides the GPS coordinates. Either probably wouldn’t be too difficult to implement. But that’s a feature request.
I assume that’s Lovelace? I don’t use it, but in the “regular” UI, all you have to do is click on the entity and a window pops up with more details, including the GPS coordinates. Is that not also possible in Lovelace?
That makes sense. My hope is that having the iOS app configured like this, it just uses geofencing instead of having HA do the math for the zone.
Ideally, it wouldn’t even need to send true coordinates, just zone_entered or zone_exited, especially since iOS has geofencing APIs built-in. As it is, I’d thought that this setting would only send location updates when it senses zone enterance/exits. If not, that’s okay, I can just use the tricks above to mask it but it seems a lil hacky, and if rather just not waste data sending updates that’ll just be hidden away anyways.
FWIW, I did a quick experiment. On the States page I clicked on a GPS-based device_tracker (that was not currently in a zone), then changed its attributes by removing longitude, latitude and gps_accuracy and clicked SET STATE. Then I went to the map and sure enough the icon for that device_tracker was gone. The icon for the device_tracker in a “regular” view was, of course, still there, but when I clicked on it the GPS coordinates were gone. Of course, as soon as the device_tracker updated itself it reappeared on the map and the GPS coordinates came back in the regular view.
If you’re comfortable editing Python code, it should be extremely easy to prevent the GPS attributes from being added to the device_tracker entity in the first place when it’s “Away” by modifying this line. Change it to:
if self.gps and self._state != STATE_NOT_HOME:
I haven’t tested this, but it should work, allowing the GPS coordinates to be shown in attributes only when the device_tracker’s state is not “Away” (which typically means it must be in a zone.)
Now, having said that, there are several reasons why this might not cover all the bases. First and foremost, some device_tracker platforms provide other attributes (such as address) that might give away the device’s location, even if the GPS coordinates themselves are not shown. Next, some device_trackers (such as my Life360 platform) can change the device_tracker’s state to something other than ‘not_home’, even when the device is not in a zone, so the simple test above would not cover that case.
I do think it would be a nice feature for the device_tracker infrastructure to support the ability to hide a device’s GPS location when not in a zone (or maybe always), even though it still has it and uses it “under the hood”, but to implement that properly and completely would be a bit involved.
Oh wow, you did some serious digging, I really appreciate it! I’m away from home for a little ways but I’ll try out what you found ASAP and report back.
Sorry for reviving an old post, but I have the exact same question as pyrosmiley.
Pyrosmiley, did you find a solution that worked for you?
Does anyone know if the functionality is planned, either as part of HA or iOS app 2.0?
It seems to me that only one update with location is pushed, the one when the state changes. So people are stationary in a single position until they enter a new zone. I may try to use Node Red to wipe GPS position when state changes to away. Then the icons are removed from map at least.
Hi, I’m so sorry for never posting again like I said I would. I actually forgot entirely to try modifying the underlying python, so I don’t know yet whether that fixed it or not. That said, I’m on Hassio so I’m not sure how permanent of a solution that would be anyways.
To answer your question, I never did necessarily get a fix for it, I just turned off the map entirely. I’m still not comfortable with having the GPS data under the entities, but at least it’s harder to see. Seems to me your idea of an automation to try to overwrite the actual data upon “Away” status might be best.
In the HAC 2.0 beta, I noticed that the goggles for location update types are still there, so I’ll try to remember to look next time I’m away to see what’s reported (I’m the only one on betas). I did notice that the iOS location services indicator is hollow now, which generally means geofences, so hopefully that’s a good sign.
It’s not really that large a problem as there is only a single position update, but it is a bit bothersome that a person is stationary at some edge of a zone indefinitely when they exit a zone.
I tried Node Red. The latitude and longitude is an attribute of the entity state, and I found no way to manipulate that. Not a Node Red expert though, so will try some more.
I’m on the beta 2.0 as well, and it has the same behavior as far as I can see. I would like to see an option: “Set lat/long to null when leaving zone”.