home-assistant / android

:iphone: Home Assistant Companion for Android
https://companion.home-assistant.io/
Apache License 2.0
2.33k stars 650 forks source link

High accuracy mode no longer disables when leaving zone #3445

Closed segfaultex closed 1 year ago

segfaultex commented 1 year ago

Home Assistant Android app version(s):Android 2023.3

Android version(s):13

Device model(s): Pixel 7

Home Assistant version:2023.3.6

Last working Home Assistant release (if known):2023.3.6

Description of problem, include YAML if issue is related to notifications: Location Sensors/Background Location/High accuracy mode only when entering zone no longer disables when outside of selected zone

Companion App Logs:

Screenshot or video of problem:

Additional information:This has been working fine in the previous versions of the companion app

dshokouhi commented 1 year ago

Please make sure to get the companion app logs when the issue occurs so we can see what happened.

dshokouhi commented 1 year ago

Please also share the high accuracy mode settings you are using. We will need to get more data to troubleshoot and see where the issue is coming from.

splichy commented 1 year ago

I have same issue on Samsung Galaxy S20FE. I will try to collect logs.

Preference22 commented 1 year ago

I've got the same thing but with a bit more information:

I've got my zone.home setup and setup the extended high accuracy zone around it, via the settings in the app. Normally, before the last update, the high accuracy mode would only be on in that extended zone. When I entered that zone, it would turn on and turn off when leaving.

As of now, when I enter that extended zone, it does not turn on the high accuracy mode. But when I leave it does turn on the high accuracy mode and then does not turn off again. Only way to make it turn off again is go to the sensor settings in the app and make my extended zone a bit smaller/bigger and it turns the high accuracy mode off again.

I'll try to grab the logs but since that log is only a few minutes old, most of the time when I'm done commuting the logs show nothing anymore.

If my story generates more questions for me to answer, please feel free to ask me!

splichy commented 1 year ago

So yesterday I removed and then added back zone.home in High accuracy mode only when entering zone(with trigger range 400), Today when I was 1000m away from zone.home high accuracy hadn't activated, but did neither when I was coming back.

04-06 13:12:00.216 26012  1721 D LocBroadcastReceiver: High accuracy mode enabled, because defined ([28:A1:83:16:37:B5]) bluetooth device(s) connected (Connected devices: [BluetoothDevice(address=C2:02:13:06:55:13, name=Mi Smart Band 6, paired=true, connected=false), BluetoothDevice(address=28:A1:83:16:37:B5, name=MB Bluetooth, paired=true, connected=true), BluetoothDevice(address=BC:F1:71:C9:CD:85, name=PRGA-010409, paired=true, connected=false), BluetoothDevice(address=00:1B:66:B3:E9:85, name=PXC 550-II, paired=true, connected=false), BluetoothDevice(address=1C:48:F9:14:F4:03, name=Jabra MOTION a1.42.0, paired=true, connected=false), BluetoothDevice(address=91:1A:CB:F0:8D:84, name=APPT, paired=true, connected=false), BluetoothDevice(address=50:55:83:5F:F4:E6, name=50:55:83:5F:F4:E6, paired=false, connected=true)])
04-06 13:12:00.216 26012  1721 D LocBroadcastReceiver: High accuracy mode disabled, because not in zone [1_zone.home_expanded]
04-06 13:12:00.256 26012 26062 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
04-06 13:12:00.260 26012 26062 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
04-06 13:12:00.491 26012 26062 D ServerConnectionInfo: localUrl is: true, usesInternalSsid is: false, usesWifi is: false
04-06 13:12:00.523 26012 26012 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false

The phone had active Waze on the background thus location was precise, the display was on, at 13:11:34 I was 271m from zone.home at 13:12:02 128m as reported by HA proximity sensor.

When re-adding ham_zone, then the log looks like this:

04-06 14:06:12.064 26012 28380 D LocBroadcastReceiver: High accuracy mode disabled, because defined ([28:A1:83:16:37:B5]) bluetooth device(s) not connected (Connected devices: [BluetoothDevice(address=C2:02:13:06:55:13, name=Mi Smart Band 6, paired=true, connected=false), BluetoothDevice(address=28:A1:83:16:37:B5, name=MB Bluetooth, paired=true, connected=false), BluetoothDevice(address=BC:F1:71:C9:CD:85, name=PRGA-010409, paired=true, connected=false), BluetoothDevice(address=00:1B:66:B3:E9:85, name=PXC 550-II, paired=true, connected=false), BluetoothDevice(address=1C:48:F9:14:F4:03, name=Jabra MOTION a1.42.0, paired=true, connected=false), BluetoothDevice(address=91:1A:CB:F0:8D:84, name=APPT, paired=true, connected=false), BluetoothDevice(address=50:55:83:5F:F4:E6, name=50:55:83:5F:F4:E6, paired=false, connected=true)])
04-06 14:06:12.064 26012 28380 D LocBroadcastReceiver: High accuracy mode disabled, because not in zone [1_zone.home_expanded]
04-06 14:06:12.067 26012 28380 D LocBroadcastReceiver: High accuracy mode geo parameters changed. Reconfigure zones.
04-06 14:06:12.067 26012 28380 D LocBroadcastReceiver: Removing geofence location requests.
04-06 14:06:12.068 26012 28380 D LocBroadcastReceiver: Registering for zone based location updates
dshokouhi commented 1 year ago

So the way High Accuracy mode works when it comes to zone constraints is that we are only able to get zone entry/exit events from geofences reported by Google. If we never get a geofence report that a zone was entered or exited then even if a user is inside or outside a zone (according to HA) the app will not know this. When looking at your logs you need to pay attention to the geofence events that take place to see what the issue is.

One thing you can do is listen for the zone entry/exit events and look at the event data to see which zone is or is not being reported by Google as this is the data that we go by.

https://companion.home-assistant.io/docs/integrations/app-events

From the sound of things it looks like we are not receiving the zone exit events from Google which will not be easy for us to fix as we are dependent on Google notifying the app about those events.

If possible keep the app open while reproducing the issue so the logs can be complete with geofence data so we can see the full picture.

splichy commented 1 year ago

With multi server support there was added reqestId to geofence registration. Cannot that cause this?

rick-cross commented 1 year ago

I have the same symptoms but with a slightly different use case. Mine is related to bluetooth connections...

I’ve enabled the High Accuracy mode ONLY when the phone is connected to bluetooth…And I’ve selected my car’s BT, a loud-speaker and headphones as the triggers for the high accuracy mode.

So when the phone is connected to any of these, it will send (and does send) the high accuracy GPS location to HA. When the phone disconnects from BT, the high accuracy mode should automatically deactivate.

I’ve tried on the Beta and normal version of the HA app 2023.3.0-full on android 13.

splichy commented 1 year ago

It looks an evaluation logic was somehow inverted, as when I leave the expanded zone, ham activates, and then deactivates when I enter the expanded zone. I have tried to add another zone and added it to trigger zones, now ham is always active as I'm always outside one of the expanded zones: ham was active even when I was not close to any of the defined zones.

04-08 19:18:54.735  5833 19898 D LocBroadcastReceiver: High accuracy mode enabled, because defined ([28:A1:83:16:37:B5]) bluetooth device(s) connected (Connected devices: [BluetoothDevice(address=C2:02:13:06:55:13, name=Mi Smart Band 6, paired=true, connected=false), BluetoothDevice(address=28:A1:83:16:37:B5, name=MB Bluetooth, paired=true, connected=true), BluetoothDevice(address=BC:F1:71:C9:CD:85, name=PRGA-010409, paired=true, connected=false), BluetoothDevice(address=00:1B:66:B3:E9:85, name=PXC 550-II, paired=true, connected=false), BluetoothDevice(address=1C:48:F9:14:F4:03, name=Jabra MOTION a1.42.0, paired=true, connected=false), BluetoothDevice(address=91:1A:CB:F0:8D:84, name=APPT, paired=true, connected=false), BluetoothDevice(address=7B:E1:FD:B8:9E:B8, name=Smart Tag, paired=false, connected=true), BluetoothDevice(address=42:25:C4:F3:6C:A6, name=Smart Tag, paired=false, connected=true)])
04-08 19:18:54.735  5833 19898 D LocBroadcastReceiver: High accuracy mode enabled, because in zone [1_zone.home_expanded, 1_zone.hlinsko_expanded]
04-08 19:18:54.746  5833  5833 D LocBroadcastReceiver: Received location update.
04-08 19:18:54.766  5833  5833 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = true
Matmos90 commented 1 year ago

I've got the same thing but with a bit more information:

I've got my zone.home setup and setup the extended high accuracy zone around it, via the settings in the app. Normally, before the last update, the high accuracy mode would only be on in that extended zone. When I entered that zone, it would turn on and turn off when leaving.

As of now, when I enter that extended zone, it does not turn on the high accuracy mode. But when I leave it does turn on the high accuracy mode and then does not turn off again. Only way to make it turn off again is go to the sensor settings in the app and make my extended zone a bit smaller/bigger and it turns the high accuracy mode off again.

I'll try to grab the logs but since that log is only a few minutes old, most of the time when I'm done commuting the logs show nothing anymore.

If my story generates more questions for me to answer, please feel free to ask me!

Same issue here, today I will try to check the log to investigate.

energywave commented 1 year ago

I also have the same issue. I wanted to add that with previous version it was working quite well. But with this version (don't know exactly what versions) it's totally unreliable... So it sound a little strange to think that it's a google problem, if the previous version was working correctly (no OS updates in the meanwhile)

maxalbani commented 1 year ago

Same issue here ... high accuracy mode not always activate in the expanded area and not always disable when i enter in zone.

lperco commented 1 year ago

Same issue here with last update 2023.3.0. High Accurancy mode seems to start when leaving expanded zone not when entering it. I've tried to clean data and un/intall app but problem still here. With previous versione of app all works fine: entering expanded home zone High accurancy mode starts so trigger "entering zone.home" works fine.

Phone: huawei P30 with EMUI 12.0.0

bakoscsaba commented 1 year ago

I have similar issue. When high accuracy mode is enabled with a zone constraint it does not work. Location updates are received every 1-2-3 minutes only instead of 5 seconds. If I disable zone (so high accuracy mode is on all he time) it works as expected.

jpelgrom commented 1 year ago

Hi 👋 I think I've found the issue but would appreciate it if someone here could confirm if the fix works as expected.

You can download a test version of the app from here (login, click artifact.zip, unzip app-full-debug.apk), it'll install without modifying the original app if you give your device another name when logging in. Then, setup the location constraint for high accuracy mode and let me know if it works correctly again :)

mamrai1 commented 1 year ago

I can confirm it works.. Only tested when leaving home zone but it triggers correcrly high accuracy mode in conjunction with bluetooth specific connection...

mamrai1 commented 1 year ago

Screenshot_20230503_054626_io homeassistant companion android debug_edit_1023293806944895

kg333 commented 1 year ago

@jpelgrom Test version of the app appears to be working here. It didn't get stuck in high accuracy mode today.

lperco commented 1 year ago

Test version works here. Get in high accouracy mode entering expanded home zone as setup in settings. Thanks

maxalbani commented 1 year ago

Hi 👋 I think I've found the issue but would appreciate it if someone here could confirm if the fix works as expected.

You can download a test version of the app from here (login, click artifact.zip, unzip app-full-debug.apk), it'll install without modifying the original app if you give your device another name when logging in. Then, setup the location constraint for high accuracy mode and let me know if it works correctly again :)

Thank you!! When will the new version be released?

jpelgrom commented 1 year ago

Thank you!! When will the new version be released?

The change hasn't been merged to the main code base yet and the app doesn't have a set release schedule, so it's hard to tell. It's been a while since a release so I'd expect relatively soon.

When merging this issue will be closed. You can expect it to be included in the next weekly beta release after that (betas are pushed Sunday morning UTC).

rtorchia commented 1 year ago

With the last two releases I've been having similar experiences.

My high accuracy trigger range is 1 km

If I leave Home zone, then high accuracy is turned on until I leave the trigger range.

If I enter the trigger range high accuracy is not turned on, even tough the app has received several GPS location points INSIDE the trigger zone. When I enter my Home zone, it turns on, but by that time I'm at my house and in my driveway and my phone has connected to my WiFi.

Something definitely is off and is not responding to entering the trigger zone when coming home.