gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
580 stars 54 forks source link

GPS drifting - home/not-home 10x a day #274

Closed xstrex closed 11 months ago

xstrex commented 1 year ago

Not sure if this is the right place to ask for support, but figured it's a good start, if I should be directed elsewhere please let me know.

Running latest version of HA: 2023.7.2 HA Companion: 2023.4 (2023.460) Latest icloud 3 version.

While at home, and stationary, or actually using my phone, my gps location seems to randomly change to about 1/4mi SW of my actual home location/zone, outside the zone, and triggers my 'away' automation. Sometimes this happens in the middle of the day, sometimes late at night, or in the middle of the night. I've seen no pattern in when it drifts and comes back. Sometimes when I force a location update, it still thinks I'm away; standing there, in my home, in the dark.

I'm at a loss, don't know where to start troubleshooting, if it's a hardware issue, software issue, configuration issue, I just don't know; but it's incredibly annoying, and frustrating; especially when I'm sound asleep, and my 'home_night' night automation runs, thinking I just got home! All the lights on, and the phone is still on the charger, and has been for hours.

Last week I did a factory reset on the iPhone, complete formatted it, reinstalled, restored a backup, issue persists.

I'm at a loss, and really need some assistance; this is the worst location accuracy I've ever experienced in the 5yrs of using HA.

This is since midnight; I've left home once (3:15 - 4:00):

image
gcobb321 commented 1 year ago

There really is nothing you can do to correct the cause of gps wandering. Your location is determined by the gps satellites, cell phone signal, sometimes weather and other factors being your control.

There are a few things you can do, however, to reduce its impact or check for it.

  1. The device tracker state value is determined by HA based on the gps location and goes to Away then the gps it’s out of the zone. iCloud3 has a sensor.[devicename]_zone_name entity (actually several with different formats-check the docs) that it’s not changed to Away until the device is 1.5 to 2 times the zone radius distance outside the zone unless a zone exit trigger has been received from the iOS app. Use that sensor in your automations as the trigger, not the device tracker. If the distance is above the 1.5 times the zone radius, it assumes an exit trigger has not been issued and will set the sensor to Away
  2. check the value of the gps_accuracy. Sensor to see if it is above an acceptable value adds a condition in the Automation.
  3. Create another ‘home-big’ Zone where it has a 500m radius where your Home zone has a 100m radius. Your Away triggers happen when you exit that zone instead of the home zone.
  4. Add a timer and you must be outside for x minutes before it fires.

Hope this helps.

xstrex commented 1 year ago

Thanks for the response! I understand 1. above, makes perfect sense; and looking at the history of the sensor, it appears to be a lot more accurate than the device_tracker itself. I've switched my automation's to use this sensor instead.

I'm curious about the gps_accuracy sensor; I see it in my entities, and it's populating data, though I see numbers from 0 all the way to 94, is there any good way to know what an acceptable value is? It's also referenced in your documentation, though I don't see it stating that 0 is more accurate, or if 94 is; So what scale is it referencing here?

I'll try 1. for a week or so, and maybe implement 2. once I understand it better; if those still aren't accurate for me, I'll add 3. as well, and 4. if necessary.

Cheers.

gcobb321 commented 1 year ago

0 is dead on the center of your zone. What it means is the location reported is + or - the gps accuracy. So if the gps lat/long is 50m from your zone center and the accuracy is 50, the actual location could be at the center or 100m away. I’d start with 50

xstrex commented 1 year ago

I've implemented 1. 2. & 4. above, and still getting a ton of false positives not sure why, but its extremely annoying. Any other suggestions?

This was from this evening, I haven't actually left the house in 5hrs. image

gcobb321 commented 1 year ago

What is the size of your zones?

xstrex commented 1 year ago

I'm currently only using a Home zone, and radius isn't defined; though documentation says it defaults to 100m.

Still experiencing the gps drift issue, it's less common. I've also added a condition to my away automation to check to see if I'm sleeping, and fail if true which has helped with waking up with all my lights on.

gcobb321 commented 1 year ago

iCloud3 takes the gps accuracy into consideration when determining if the location is accurate. It is defined in the Configure Settings > Page 2 > Tracking Parameters screen. Mine is set to 100m.

Have you looked at the Event Log to see what is displayed at the time you get the exit zones? The Event Log is a better source of what is going on than the HA log. Are any triggers received from the iosapp at that time? What is the distance from the zone when it is triggered? iCloud3 handles the gps location it receives. If the location is poor and inaccurate, it will try to discard the bad data as best it can. You can also change the Home zone radius to 200m on the HA Settings > Areas and Zones > Zones screen and see if that helps.

xstrex commented 11 months ago

Issue went away completely after iOS 17.x upgrade.