Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add troubleshooting tool: location history #3886

Merged
merged 7 commits into from
Sep 28, 2023

Conversation

jpelgrom
Copy link
Member

@jpelgrom jpelgrom commented Sep 23, 2023

Summary

This PR adds a troubleshooting tool for location tracking: a persistent location history (up to 48 hours, enabled by default).

Location updates on Android are hard to get your head around and the current troubleshooting steps with logs aren't very user friendly. This hopefully makes it easier for users to review and for us as developers to find things to improve. The location history is specifically intended as a troubleshooting tool, which is why there is limited UI (no maps for now!) and the updates are only stored 48 hours. If someone wants to do more, it should probably be handled on the server.

UI inspiration is Android's built-in notification history, trying to get more M3 elements in the app :)

Screenshots

Light Dark
Setting in the troubleshooting menu Troubleshooting menu with entry 'Location tracking: View a history of location tracking updates to troubleshoot the device tracker(s)', light mode Troubleshooting menu with entry 'Location tracking: View a history of location tracking updates to troubleshoot the device tracker(s)', light mode
History, tap on a row to expand A list of rows with various times and subtitles like 'Background location', 'Sent/Old location/Duplicate', one item is expanded and shows a latitude/longitude, accuracy, and buttons to open a map and share, light mode A list of rows with various times and subtitles like 'Background location', 'Sent/Old location/Duplicate', one item is expanded and shows a latitude/longitude, accuracy, and buttons to open a map and share, dark mode
Empty state, off 'Use location history' toggle is off, text 'Location history is off: Turn on location history to see and review all location updates received by the app', light mode 'Use location history' toggle is off, text 'Location history is off: Turn on location history to see and review all location updates received by the app', dark mode
Empty state, no updates Screen with 'No recent locations: Location updates received by the app will appear here', light mode Screen with 'No recent locations: Location updates received by the app will appear here', dark mode
Sharing converts the update to text with details untranslated, good for issues
Created: 2023-09-23 11:18:36.512
Trigger: FLP_BACKGROUND
Result: SENT
Data: UpdateLocation(gps=[5lat, lng], gpsAccuracy=100, locationName=null, speed=0, altitude=46, course=0, verticalAccuracy=100)

Location: 5lat, lng
Accuracy: 100
Server: Home

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#987

Any other notes

The iOS app also does some location history logging but seemingly doesn't have the need to filter updates.

For the future I can imagine a status check at the top of the screen that tells you "everything is OK" or "setting X isn't optimal", which is why this screen is called location tracking and not location history.

 - Initial setup saving data, no UI, cleanup or preferences yet
 - Add a on/off setting for location history (default on)
 - Limit the history size to 48 hours, any older entries will be deleted during regular sensor updates
 - Add a basic UI for location history based on paging considering the possible data size with multiserver/high accuracy. The list looks good and shows status at a glance, detail view still needs work.
 - Make the expanded UI nicer and show relevant data, buttons for opening the location in a maps app and sharing log data
 - Add empty states for location history
 - Add option to filter by state
 - Simplify Room configuration and sort by indexed ID to improve list loading speed
Copy link
Member

@dshokouhi dshokouhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, been testing it for a few days. This should be very helpful to users who have issues with location tracking.

@JBassett JBassett merged commit b0ad11d into home-assistant:master Sep 28, 2023
3 checks passed
@jpelgrom jpelgrom deleted the location-history branch September 28, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants