Problem with high accuracy mode (mode "freezes")

Hello community,

i’m using the companion app (latest beta since i have a wear os watch, 2021.12.3) and have a zone.home_expanded activated in the app. My home zone is 100m, the expanded zone is 400m. So if i arrive at home and the distance drops under 500m the high accuracy mode enables (in the moment the normal location updates runs). If i’m arriving with a walk this works very fine.
But when i’m with the car i’m sometimes too fast. So i have an automation that triggers about 2000m distance and enables the high accuracy mode with a notification command. This also works, high accuracy is enabled and works outside the zone.home_expanded.
No comes my problem, it works as long as i don’t enter the zone.home_expanded. In this moment the app still says high accuracy mode is on (the binary_sensor.sm_g996b_high_accuracy_mode is on and the notification is there) but it doesn’t update anymore or only after a few minutes (even the shown accuracy in meters are frozen, normally this changes after a few seconds). I have to disable the mode and enable again to get it working again.
Today i tested it with a walk, here is the legend of my walk:

Screenshot 2022-01-01 151424

The red line is where the zone.home_expanded begins. With manually enabled high accuracy mode it works fine outside the zone (i came from up and right), but in the moment i enter the expanded zone (and high accuracy should be enabled by the app automatically) it stops.
Am i doing something wrong or is this a bug of the app?

Thanks in advance Mike

Check the logs in app configuration to see if anything comes up

Sorry, i forgot about the logs. Here they are, problem must be somewhere at 10:35:42.

01-02 10:35:38.650 26154 26154 D LocBroadcastReceiver: Received location update.
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Last Location: 
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Coords:(53.9988351, 9.9953077)
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Accuracy: 3.866
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Bearing: 206.05516
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: Received location that is 1661 milliseconds old, 1641116137000 compared to 1641116138661 with source fused
01-02 10:35:38.661 26154 26154 D LocBroadcastReceiver: New location update not possible within 5 seconds, not sending to HA
01-02 10:35:38.670 26154 26154 D ActivitySM: Received activity update.
01-02 10:35:38.681 26154 26154 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
01-02 10:35:39.450 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:39.934 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:39.949 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:39.953 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:40.674 26154 26154 D LocBroadcastReceiver: Received location update.
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Last Location: 
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Coords:(53.9988111, 9.9952982)
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Accuracy: 4.052
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Bearing: 203.74522
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: Received location that is 1685 milliseconds old, 1641116139000 compared to 1641116140685 with source fused
01-02 10:35:40.685 26154 26154 D LocBroadcastReceiver: New location update not possible within 5 seconds, not sending to HA
01-02 10:35:40.941 26154 26154 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
01-02 10:35:40.964 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:41.063 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:41.068 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:42.678 26154 26154 D LocBroadcastReceiver: Received location update.
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Last Location: 
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Coords:(53.9987863, 9.99529)
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Accuracy: 4.279
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Bearing: 201.52959
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
01-02 10:35:42.687 26154 26154 D LocBroadcastReceiver: Received location that is 1687 milliseconds old, 1641116141000 compared to 1641116142687 with source fused
01-02 10:35:42.692 26154  8502 D UrlRepository: localUrl is: false and usesInternalSsid is: false
01-02 10:35:42.698 26154 26154 D LocBroadcastReceiver: Received geofence update.
01-02 10:35:42.702 26154 26154 D UrlRepository: localUrl is: false and usesInternalSsid is: false
01-02 10:35:42.825 26154  8502 D LocBroadcastReceiver: Location update sent successfully
01-02 10:35:42.830 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:42.876 26154 26154 D LocBroadcastReceiver: Event sent to Home Assistant
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Last Location: 
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Coords:(53.9987863, 9.99529)
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Accuracy: 4.279
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Bearing: 201.52959
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
01-02 10:35:42.879 26154 26154 D LocBroadcastReceiver: Skipping old location update since time is before the last one we sent, received: 1641116141000 last sent: 1641116142687
01-02 10:35:42.889 26154  3997 D LocBroadcastReceiver: High accuracy mode enabled, because in zone [zone.home_expanded]
01-02 10:35:42.890 26154  3997 D LocBroadcastReceiver: High accuracy mode parameters changed. Enable high accuracy mode.
01-02 10:35:42.890 26154  3997 D LocBroadcastReceiver: Removing background location requests.
01-02 10:35:42.894 26154  3997 D HighAccLocService: Try starting high accuracy location service (Interval: 5s)...
01-02 10:35:42.894 26154  3997 W ForegrndServiceLauncher: Cannot start service HighAccuracyLocationService. Service is not running...
01-02 10:35:42.942 26154 26886 D ConnectivityManager: StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:3925)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4489)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4456)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4430)] [androidx.work.impl.constraints.trackers.NetworkStateTracker.startTracking(NetworkStateTracker.java:89)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.java:71)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.java:99)] [androidx.work.impl.constraints.WorkConstraintsTracker.replace(WorkConstraintsTracker.java:106)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:157)] [androidx.work.impl.Schedulers.schedule(Schedulers.java:119)] [androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:135)] [androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:95)] [androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)] [java.lang.Thread.run(Thread.java:920)]
01-02 10:35:43.033 26154 26154 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
01-02 10:35:43.062 26154  3997 D SensorWorker: Updating all Sensors.
01-02 10:35:43.065 26154 26212 I WM-Processor: Moving WorkSpec (b826de83-cd49-4c0e-8045-016709e60014) to the foreground
01-02 10:35:43.071 26154 26154 I WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=io.homeassistant.companion.android/androidx.work.impl.foreground.SystemForegroundService (has extras) }
01-02 10:35:43.079 26154  3997 D ActivitySM: Unregistering for activity updates.
01-02 10:35:43.079 26154  3997 D ActivitySM: Registering for activity updates.
01-02 10:35:43.171 26154 26154 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
01-02 10:35:43.173 26154  7781 D LocBroadcastReceiver: High accuracy mode enabled, because in zone [zone.home_expanded]
01-02 10:35:43.199 26154 26154 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
01-02 10:35:43.247 26154  3997 D UrlRepository: localUrl is: false and usesInternalSsid is: false
01-02 10:35:43.284 26154 26163 D InputTransport: Input channel destroyed: 'ClientS', fd=274
01-02 10:35:43.309 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:43.312 26154 26189 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=b826de83-cd49-4c0e-8045-016709e60014, tags={ io.homeassistant.companion.android.sensors.SensorWorker } ]
01-02 10:35:43.316 26154 26154 I WM-SystemFgDispatcher: Stopping foreground service
01-02 10:35:43.322 26154 26154 D ConnectivityManager: StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4598)] [androidx.work.impl.constraints.trackers.NetworkStateTracker.stopTracking(NetworkStateTracker.java:112)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.java:86)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.java:97)] [androidx.work.impl.constraints.WorkConstraintsTracker.replace(WorkConstraintsTracker.java:106)] [androidx.work.impl.foreground.SystemForegroundDispatcher.onExecuted(SystemForegroundDispatcher.java:144)] [androidx.work.impl.Processor.onExecuted(Processor.java:304)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:377)]
01-02 10:35:45.335 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:47.252 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:48.376 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:48.379 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:49.017 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:49.020 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:49.027 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:49.028 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:51.007 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:51.015 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:51.016 26154  6132 D WebSocketRepository: Websocket: onMessage (text)
01-02 10:35:51.256 26154  6132 D WebSocketRepository: Websocket: onMessage (text)

did you compare the GPS coordinates to where you are expected to be? I think the geofencing could be delayed at times and not be as instant as you would expect it to be sometimes. When it comes to this feature we are at the mercy of Google sending us updates. If we dont get an update then we cant react to anything. Look at the “Received location update” or “Received Geofence update” log lines to see what data google told the app that it has.

I did not double check the coordinates, but it is stopping its updates at the right place where my geofence begins (its always the same house i am at :wink:). I changed the coordinates above a little bit to “shadow” my place.

01-02 10:35:42.894 26154  3997 D HighAccLocService: Try starting high accuracy location service (Interval: 5s)...
01-02 10:35:42.894 26154  3997 W ForegrndServiceLauncher: Cannot start service HighAccuracyLocationService. Service is not running...

As i would interprete the logs that the companion tries to start the high accuracy mode (which is already running) and fails and the service stops some way. So my 2 cents, Maybe a check in the app if its already running when entering the geofence would solve the problem…

Can you create an issue on github with these logs? you can just remove teh coordinates themselves, I think we may not be setting a variable appropriately when its triggered via the notification command which could be causing this conflict.

No problem, done. I hope i have put it down right so everybody understands it.

https://github.com/home-assistant/android/issues/2102

1 Like

Not that the issue shouldn’t be fixed, but adding a Bluetooth device in the car is great for this purpose.

I have this one connected in the car and it work 95-99% of the times.

https://m.aliexpress.com/item/32878241482.html

I tried the new beta with your fixes from tonight. There is a change in the behaviour, now you can’t enable the high accuracy mode when your outside zone.home_expanded with the notify command. To be exactly, you can enable it, for half a second there is the icon in the upper bar, then the icon disappeares and high accuracy is off again.
Here are the logs:

01-05 12:56:53.402 26728  5064 D MessagingService: From: 313041709873
01-05 12:56:53.403 26728  5064 D MessagingService: Message data payload: {title=turn_on, message=command_high_accuracy_mode}
01-05 12:56:53.403 26728  5064 D MessagingService: Processing device command
01-05 12:56:53.408 26728 26728 D HighAccLocService: Try starting high accuracy location service (Interval: 5s)...
01-05 12:56:53.409 26728 26728 D ForegrndServiceLauncher: Start service HighAccuracyLocationService
01-05 12:56:53.412 26728 26728 D ForegrndServiceLauncher: Service HighAccuracyLocationService was created. Start service
01-05 12:56:53.412 26728 26728 D HighAccLocService: High accuracy location service created -> onCreate
01-05 12:56:53.413 26728 26728 D HighAccLocService: High accuracy location service (Interval: 5s) started -> onStartCommand
01-05 12:56:53.433 26728 26995 D ConnectivityManager: StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:3925)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4489)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4456)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4430)] [androidx.work.impl.constraints.trackers.NetworkStateTracker.startTracking(NetworkStateTracker.java:89)] [androidx.work.impl.constraints.trackers.ConstraintTracker.addListener(ConstraintTracker.java:71)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.java:99)] [androidx.work.impl.constraints.WorkConstraintsTracker.replace(WorkConstraintsTracker.java:106)] [androidx.work.impl.background.greedy.GreedyScheduler.schedule(GreedyScheduler.java:157)] [androidx.work.impl.Schedulers.schedule(Schedulers.java:119)] [androidx.work.impl.utils.EnqueueRunnable.scheduleWorkInBackground(EnqueueRunnable.java:135)] [androidx.work.impl.utils.EnqueueRunnable.run(EnqueueRunnable.java:95)] [androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)] [java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)] [java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)] [java.lang.Thread.run(Thread.java:920)]
01-05 12:56:53.444 26728 26886 D SensorWorker: Updating all Sensors.
01-05 12:56:53.445 26728 26803 I WM-Processor: Moving WorkSpec (36210e51-b6ac-46c2-9290-0bc46c3c4343) to the foreground
01-05 12:56:53.451 26728 26728 I WM-SystemFgDispatcher: Started foreground service Intent { act=ACTION_START_FOREGROUND cmp=io.homeassistant.companion.android/androidx.work.impl.foreground.SystemForegroundService (has extras) }
01-05 12:56:53.458 26728 26886 D ActivitySM: Unregistering for activity updates.
01-05 12:56:53.458 26728 26886 D ActivitySM: Registering for activity updates.
01-05 12:56:53.559 26728 26739 I mpanion.androi: Background young concurrent copying GC freed 324836(16MB) AllocSpace objects, 15(428KB) LOS objects, 33% free, 34MB/52MB, paused 86us,43us total 122.660ms
01-05 12:56:53.559 26728 26739 W mpanion.androi: Reducing the number of considered missed Gc histogram windows from 151 to 100
01-05 12:56:53.592 26728 26728 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
01-05 12:56:53.594 26728 12457 D LocBroadcastReceiver: High accuracy mode disabled, because not in zone [zone.home_expanded]
01-05 12:56:53.599 26728 12457 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
01-05 12:56:53.607 26728 12457 D HighAccLocService: Try stopping high accuracy location service...
01-05 12:56:53.611 26728 12457 D ForegrndServiceLauncher: Stop service HighAccuracyLocationService
01-05 12:56:53.611 26728 26728 D ForegrndServiceLauncher: Service HighAccuracyLocationService was destroyed. Stop service
01-05 12:56:53.612 26728 12457 D LocBroadcastReceiver: Registering for location updates.
01-05 12:56:53.614 26728 26728 D HighAccLocService: High accuracy location service stopped -> onDestroy
01-05 12:56:53.618 26728 26728 I WM-SystemFgDispatcher: Stopping foreground service
01-05 12:56:53.624 26728 26728 D ConnectivityManager: StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:4598)] [androidx.work.impl.constraints.trackers.NetworkStateTracker.stopTracking(NetworkStateTracker.java:112)] [androidx.work.impl.constraints.trackers.ConstraintTracker.removeListener(ConstraintTracker.java:86)] [androidx.work.impl.constraints.controllers.ConstraintController.replace(ConstraintController.java:97)] [androidx.work.impl.constraints.WorkConstraintsTracker.replace(WorkConstraintsTracker.java:106)] [androidx.work.impl.foreground.SystemForegroundDispatcher.onExecuted(SystemForegroundDispatcher.java:144)] [androidx.work.impl.Processor.onExecuted(Processor.java:304)] [androidx.work.impl.Processor$FutureListener.run(Processor.java:377)]
01-05 12:56:53.625 26728 26728 I WM-SystemFgDispatcher: Stopping foreground service
01-05 12:56:53.644 26728 26886 D UrlRepository: localUrl is: false and usesInternalSsid is: false

Seems because of the change in the code the service everytime checks if it should be on, and if you are out of your zone it is disabled because you are out of your zone (which isn’t good when enabled by the command out of the zone :wink:). Maybe there are some to does on the logic.
Anyway thanks for the work you do and have done! Should i open another issue on github or reply to the closed one?

@Hellis81 what are you doing with this item, checking if you are in the car?

Yes. When I turn on the car it connects to my phone and I can use the high accuracy based on bluetooth connection instead.
And it’s a fantastic device in the purpose it’s intended to also.

Ok, i understand what you do. I am connected with the hands free and the media player of the car, so i can do the same. But since i don’t connect the power cable every time i’m in the car it would drain my battery too fast, that’s why i tried to use it only the last mile to home.

Really?

Here is an almost one hour drive with high accuracy on.

From 95 to 87%

Ok i’ll reopen the issue…thanks for testing :slight_smile:

Just FYI, this issue is fixed with a PR from chriss158 https://github.com/home-assistant/android/pull/2383
Thanks to anyone who invested time and effort in it.

A last question, is it possible to disable a running high accuracy mode without disabling the whole function?
For example, i enable it via notification command when in my car and the distance to home is less than 3000m. There may be reasons i get that near but have another goal than my home. So i want if the distance raises again above 3000m disable the actual high accuracy mode. But only the actual process, not the hole function. Is that possible?

if you want to get more specific than the current options then your best bet is to control it via automation directly instead of relying on app built features, the more we attempt to add to this feature the more bugs we can introduce so best for users with very specific needs to just use the command and control it how they see fit