Reliable "Coming home" detection on Android

I have home assistant running on a public domain and have installed the companion app on my device (Pixel 7 running Android 16). Now I want to create an automation that runs when I am on my way home; I have created a Proximity sensor to detect that (with an automation that runs when my distance changes to <1km and I am moving towards my home, triggered by either and requiring both). For my purpose it is enough to have a rough time frame on when I’ll get home (ie. when something runs when I’m 1-2km away thats enough); however my automation runs only very inconsistently - mostly only when I take out my phone and unlock it, where when I have to do that I might as well simply press a button to run my automation.

I have given the app unrestricted battery optimization, enabled background location and Single accurate location and even tried sending the request_location_update notification command every 10 minutes, all to no avail.

I have also tried letting it just detect entering a zone (eg. one I created thats a km around my home), but I got the same consistency there.

Are there any other tricks that could be used to force my phone / the app to update my location frequently enough that this will work? I am also fine with sacrificing a bit of my battery life for this as long as it works consistently.

Have you tried high accuracy mode? You could set it to kick in only when entering your extended home zone to avoid battery drain.
Otherwise, if your car has a bluetooth headunit (assuming you travel by car), you could use the bluetooth constraint so that high accuracy is enabled only when connected to a specific bluetooth device. I’ve been using this one reliably for the past couple of years, and have rarely ever had it fail on me.

In theory, enabling high accuracy mode when I enter a zone sounds good, but the problem is that even entering the zone is not detected…

Also I am traveling by bike, so the bluetooth approach sadly won’t work…

You need to set it up to move from theory to real world application. Have you?

double check location tracking is setup properly, then you can look at the location tracking history to see if your settings need any adjustments like if accuracy is too low

https://companion.home-assistant.io/docs/troubleshooting/faqs/#device-tracker-is-not-updating-in-android-app

I am using the FritzBox Tools integration to monitor WIFI connection status of our (4) Android phones, and that works extremely well without any software or setup on the phones themselves (other than disabling the MAC Adress randomisation so the MAC stays stable across reconnects). There are many router brands with good HA integration, maybe you could look up if your router is supported by HA…
Here is the integration category where many of the routers are: Integrations - Home Assistant

OP wants detection when he’s 1-2km away from home. I seriously doubt his WiFi will reach that far.

This is setup properly, but I did just read about the location tracking history feature which tells me that the location is in fact sent every 5 minutes max, leading me to believe that the problem is the proximity integration after all… Apparently the ‘direction of travel’ only yields ‘towards’ for a single point in time and immediately changes back to stationary, which is different from what I expected it to do - even though not directly hitting the problem your answer has still helped me greatly to find the root cause - thank you!

1 Like