Geolocation tracking is not working properly on one of our phones, the detected location regularly randomly changes to a location far away, even though the phone is home. This appears to be a bug. No idea if its with companion, home assistant or even google, two identical samsung phones, only one seems to suffer from this.
To work around this, and ensure the phone is detected home correctly, I want to use the fact it is connected to our home wifi to override the geolocation. I have the wifi connection sensor from companion, how do I use this to change the tracker to home while its connected to our wifi?
Ive looked in to tracker.see but I dont seem to understand how Im supposed to use it.
You can use device_tracker.see in an automation, where you check the wifi SSID every time the zone of the device tracker changes from home to another state and if the SSID is still your home wifi. Set the location_name to home.
The way I do it is to add a second device tracker to my person. My network integrations (UniFi and Fritz Box) provide for each network device a device tracker, which I can use to determine if a certain network device (e.g. phone) is in the network/at home. Using two trackers prevents the jumping of the GPS location, affecting the zone of my person.
The tracker entity id is device_tracker.gsm_denise. I tried using the full entity_id but that fails to execute with an invalid slug error.
The way I do it is to add a second device tracker to my person. My network integrations (UniFi and Fritz Box) provide for each network device a device tracker, which I can use to determine if a certain network device (e.g. phone) is in the network/at home. Using two trackers prevents the jumping of the GPS location, affecting the zone of my person.
My routers arent supported, and googling on this I found as many people having issues with this way of tracking, and I even read that people have issues that gps takes precedence even though the docs say otherwise, so it might not even solve it.
But companion wifi sensor does give the correct SSID, even when the location is way off, there has to be a way to use that. I can use the wifi sensor “manually” in all my automations, but thats rather silly and wouldnt work with alarmo.
I can just say it works very well for me.
If your router can’t provide the data you could manually create a device tracker and set the state in an automation according to changes in your SSID:
In regards to device_tracker.see: Not an expert here, have just used it once during testing and it worked for me setting the home state.
Ok, now Im getting somewhere, thanks. I can not update the location of my phone’s tracker, but device_tracker.see actually creates a new tracker entity
And then I can update its location through dev tools by calling the tracker.see service. Dont understand why I can update this tracker, and not my phone’s tracker, but ok.
Now lets find out if I add it as a tracker to my person whether it supersedes the companion GPS geolocation tracker or not. If it doesnt, it wont have helped, but lets hope.
Oh man, they arent making this easy and documentation seems lacking.
I added the wifihometest tracker to my person trackers, then spoofed a GPS location on my phone and immediately HA decided I was not_home, ignoring the new tracker.
Then I thought, why wouldnt it, since both trackers have “gps” as source type attribute, makes sense to use the most recent one or highest accuracy, how do I tell HA that the wifihometest tracker is no gps and what do I change it to? The services page doesnt provide such option, I cant find this in the docs, but I found elsewhere “router” is a valid source type, so I changed the attribute to router using dev tools:
Ah, to answer my own question, this seems undocumented, its not even listed as available parameter in dev tools, but it works, just add source type parameter:
Providing something other than router or gps also gives an error showing the valid options:
Failed to call service device_tracker.see. expected SourceType or one of ‘gps’, ‘router’, ‘bluetooth’, ‘bluetooth_le’ for dictionary value @ data[‘source_type’]. Got None
…but often the the device tracker diodorusphonewifiname changes to not_home (typically after around 3 minutes) even if sensor.phone_diodorus_wifi_connection does not change. it’s driving me crazy - I don’t get why that is happening.