Open wbyoung opened 1 month ago
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (device_tracker
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
device_tracker documentation device_tracker source (message by IssueLinks)
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (mobile_app
) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)
mobile_app documentation mobile_app source (message by IssueLinks)
Android and iOS handle location updates completely different. This should be split up and appropriate bugs should be filed in the appropriate repos. For android we have logs to help troubleshoot location issues but for iOS I cannot speak for that. The apps are responsible for sending the latest location updates to the server, much like they are responsible for sending the latest state update.
I've cross posted to:
I just experienced this issue again today. Previously it was from an iOS device. Today it was from an Android device. The behavior is the same between the two. Clustered updates are arriving and being processed in an order that doesn't make sense since the device was traveling in a straight line (and not zig-zagging back to where they came from).
are you using the person
entity for tracking or the actual device_tracker
entity? this issue is tough to follow without core debug logs. also we shoudl not keep duplicates open we need to determine where the issue is first, if any.
I'm using the person
entity.
Is it not even worth discussing conceptually whether the race condition is possible (on each platform) and whether or not that behavior is acceptable?
For the person
entity try to double check its configuration and make sure the correct devices are attached to it. We have seen users have issues with misconfigured person
entities.
Before looking at the data the server gets its important to verify the data the app is sending to the server. The android app actually has certain logic in place to ensure we send the latest update to the server. The history and logs show the evaluation process already done.
For both me and my wife, the devices are configured properly on each person
. It's only tracking one device for each of us.
The problem
Today I noticed some location updates that weren't really possible to have happen (if the device GPS was indeed accurate):
This is a 35 mph road, and there's no way that I was traveling 120 mph part way down the road just to turn around and head back to the store a minute later at 50mph. :wink:
Probable Cause
I think the mobile app tried to send a few updates to the server, and for whatever reason the HTTP requests ended up taking some time to complete or needing to be retried. (This seems like it should be expected to happen decently often with the mobile app since mobile networks aren't incredibly reliable.) In the meantime, several other updates were processed and made their way to the server. The requests just ended up making their way to the server out of order making it appear as if I moved back and forth.
Related Code
The registered webhook simply dispatches a
SIGNAL_LOCATION_UPDATE
message that data was received, and the data gets written directly into the entity.Possible Solution
The data that gets sent to the webhook for iOS and Android should include a
device_timestamp
which can be stored along with the data when written. Additionally, the timestamp can be compared to the last value stored. The data should only be updated when:device_timestamp
is greater than the exiting stored valuedevice_timestamp
(hasn't yet received an update from a mobile app version that added the field)device_timestamp
(the mobile app was downgraded to a prior version and is no longer sending the field)What version of Home Assistant Core has the issue?
core-2024.9.3
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
device_tracker
Link to integration documentation on our website
https://www.home-assistant.io/integrations/device_tracker/
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