Is it possible for the Android app to automatically mark my location as home when I connect to the home wifi?

No matter what I’ve read here, I only seem to be able to get the location tracking to work about 80% of the time. I’m kinda fine with that at this point. However, it would be awesome if it could mark me home once I connect to the home wifi. Is that possible?

Or would I need have HA track the wifi I’m connected to and add some other device tracker? Or something else?

Interested in solutions too.

I have a guest staying and his android phone only marks him as home 60% of the time. Where as my iPhone marks me as home as soon as it connects to my wifi as I drive up to the house 100% of the time.

After confirming these steps the next step in troubleshooting is to look at the companion app logs to see if any events are skipped.

Sorry, are you suggesting that it should mark me home once connected to wifi?

And I would already be happy if HA would at least mark me as “unknown” when I leave my wifi :wink: I’m permanently “home”, as I don’t have my HA made available from outside, and therefore the app doesnt get to dedicatedly set a new location anyway

Easiest solution would be that you have a network integration for your router, WiFi etc. that has device tracker entities for all devices. Check if your network equipment is listed here: Presence Detection Integrations
You add this as second device tracker to the person entity.

Second option is to create your own device tracker entity and link it through an automation to your phones WiFi sensor. Use device_tracker.see for this. If you call this service from the dev tools with an unknown entity name it will create this entity for you. Once the entity is created you can make an automation that triggers based on your companion WiFi sensor. You once again call device_tracker.see and set the desired state for the device tracker entity you created in the previous step. Then you link the device tracker to the person entity.

2 Likes

From my experience it does not.
It would be a really awesome feature to link WiFi SSIDs to zones directly in the app settings, so the tracker entity reports the correct state right away.

I do this with an automation and an MQTT device tracker to give me a device_tracker that’s home when connected to the WiFi and not_home otherwise.

Your answer is to not use the app for home/away :wink:

No but it should update within a minute if arriving home. That’s why I said the best way to troubleshoot is the logs mentioned in the link.

Why not the WiFi connection sensor? It updates as soon as you are connected or not.

Just for clarity, you’re saying because of the wifi it should update within a minute? Or are you saying using Location Services? Just trying to determine exactly what we’re troubleshooting.

Thanks!

  1. It does not provide a device tracker entity. I’d need an extra automation to link the WiFi sensor to a device_tracker entity (as described above)
  2. Although the companion app is very reliable, it is not 100% reliable in updating sensor statuses (probably a phone issue, not complaining about the app, which I very much love). My UniFi integration on the other hand is rock solid.
  3. You can track every phone this way not just the ones with a companion app

it does not update with wifi, just location services but when setup properly the app also has geofences which should mark you as home pretty quickly too. You won’t know if an event is skipped if you don’t look at the logs. We print all location data to the logs so they are easy to troubleshoot. Did you look to see if you had any events skipped? Its possible wehn you get home the accuracy of a report no longer meets the requirements and you as a user can change teh accuracy to match the skipped reports so it works better.

that does not sound right at all, but again the logs will tell what is happening. If you are experiencing delays due to doze then you need to look into turning off battery optimization and any other setting a manufacturer would create to save battery. Updating sensors should be reliable, especially sensors that are meant to update instantly like wifi connection.

I use the WiFi connection sensor as a trigger for an automation to use this python script to set my state to home. It works perfectly every time.

here is the existing feature request for the actual ask here

Would it be okay to share logs with you privately? If it matters, I see a bunch of this:

01-14 11:30:56.566 10355 12159 D LocBroadcastReceiver: High accuracy mode disabled, because not in zone [zone.home_expanded]

Sure that’s fine, that log message isn’t related. The logs will show when location updates come in and if they are sent or rejected.

So last night I must have been home for 10 minutes before I realized that HA hadn’t set me as home. Within a couple seconds of me turning the screen on to pull logs, it fixed itself. I saw this in the logs:

01-17 20:18:50.623 32655  9535 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
01-17 20:18:50.623 32655  9535 D LocBroadcastReceiver: Removing background location requests.
01-17 20:18:50.624 32655 32655 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
01-17 20:18:50.637 32655  9535 D LocBroadcastReceiver: High accuracy mode disabled, because not in zone [zone.home_expanded]
01-17 20:18:50.638 32655  9535 D LocBroadcastReceiver: Registering for location updates.

It seems it didn’t realize it didn’t get any updates until I turned the screen on.

@dshokouhi Any ideas? Thanks!