I have an automation that sends an alert whenever my wife or I enter the “home” zone. This automation was working flawlessly for years. Then we got new phones (OnePlus 10), and the automation became unreliable. I was never able to fully resolve the issue. YES, I HAVE GONE THROUGH ALL THE STEPS HERE
I have reinstalled the app (obviously… 2 new phones); I have cleared cache/data; I have ensured all permissions and settings are correct; the companion app is allowed to run in the background;
I would not be writing this post if I had not gone through all of the prescribed troubleshooting
So, now more detail on exactly HOW it’s malfunctioning… If I open the Home Assistant app on my phone, the alert usually fires right away. This leads me to believe that it has more to do with the app not actually running in the background, than a permissions issue for location, specifically.
Here are my location logs from a recent bike ride.
I left at 10:38
I actually left the “home” zone around 10:45
It records me leaving the zone at 10:52
No more updates until 11:19, even though I traveled almost 10mi in that time
I’ve got a Pixel 8 Pro and found Android to be more aggressive at putting background apps to sleep to save battery life.
Android app → Settings → Companion App
Background access YES
Sensor Update Frequency → Normal
Sensors → I disable almost all, except Background Location + Location Zone
If your issue is the timestamps, Sensor Update Frequency says 15 minute interval on Normal.
I explicitly don’t send precise location as that both eats battery, and not required for my use case. Stuff like triggers when walking past a common shopping area weren’t useful enough, and I can remember to take the phone up and fire up the HA app which updates.
Beyond that, create an automation trigger on location zone with action notification - when it changes, explicitly tell you on the device.
actually the time gaps in your history logs means that Google has not notified the app that it has an update. So we dont have anything to send if we dont get notified. You have confirmed the background access tile mentioned in the troubleshooting steps already? on the one plus device you probably have more settings to disable than just battery optimizations
I am struggling with the exact same problem on my Pixel 8a!
I’ve done all the same steps as mentioned in the original post here but have the same results.
NOTE: I live on a tiny island in the Caribbean so my travel time to work is about 5 min and my zones are not that far apart, but still almost 900m according to my proximity integration
I did a test today by setting my screen timeout to 10min and left the app open while i travelled. If the app is open and the screen on, my device tracker updates way more frequently. It now notices me leaving my home zone and sets me to away before i enter my work zone.
If the app is closed or the phone screen off, i can be at work for anywhere between 10 min and 2h before it updates my location.
So it seems once the screen goes off or the app is not in the foreground the frequency of updates goes down dramatically or just stops until you open the app.
Is there a “special” permission/setting we need to change to make it work as expected in the background?
I’ve checked all the settings they talk about in the documentation of the Mobile app.
Odd - do you have Data Saver turned on all the time?
My Pixel shows:
Background data Enable usage of mobile data in the background
Makes sense to have ON to allow reporting back to HA
Unrestricted data usage Allow unrestricted data access when Data Saver is on
Mine is OFF but HA works, likely as I very rarely use Data Saver.
TBH - there are so many dark corners of settings at the Android and HA App level, it’s perfectly possible to have turned many things ON or OFF before noticing location updates are working. In many ways this is GOOD as it gives us lots of flexibility, however it does risk some experimentation!
iOS is just as bad - a friend couldn’t get HA working on an iPhone for two months, only to find he’d inadvertently installed a VPN client as part of a near-useless “security suite” (it’s iOS not Windows 95 so not much can be added). Oddly enough, when packets started exiting on the LAN in the clear, discovery worked.
Try setting your screen time out to 30 min and leave the app open. Just to see if things work as expected then.
It’s not a solution but it might give us an idea what’s wrong?
I’m in the exact same boat as you! For me everything works as expected when the app is open and screen turned on
FYI you aren’t crazy - something is broken in the app. I have the same issue on my Pixel 8A.
I have an automation to show a notification when I put my phone on a charger, but unless I open the HA app (or have opened it recently), that notification is even delayed by up to 5 minutes. I have the sensors set to fast updates when charging so that should be instant.
The app is definitely being killed in the background regardless of following every troubleshooting step. I might downgrade and see if that helps.
This is an unrelated issue that some users experience, us developers have yet to experience it. The issue is that the OS is delaying the app from receiving intents that we depend on to update sensors quickly. Personally speaking it works well and all sensors update as expected.
I’ve done multiple tests now driving between home and work.
If i keep the screen on and the app on the foreground, i get updates as expected. Roughly every minute and it recognizes me moving between zones.
If i turn off the screen, the updates are very random, but always with a bigger time gap in between. It never sets my status to away, it only picks up that i’m in a zone for a long time.
This makes me conclude that i’m either still missing a setting on my Pixel 8a to really keep the app running in the background, or there is something wrong with the app on new Pixel phones. Really hoping it’s the first one and somebody can point me in the right direction
I think the problem is Android 13 and over is killing the app when the phone screen is turned off. I don’t know the solution, but I’d love for someone smarter than me to tell me what to do
that is already turned off for me.
When i did the reset of the Mobile app i had to allow the location sensors access again, and i didn’t add or change any of the location sensors afterwards.
So it’s all set as the companion app suggests