I have an automation for turning on lights when I return home at night. It was working fine until I changed to a new phone (Pixel 10 Pro). When I look at my distance in History, I see this when I leave:
It looks as if HA is not noticing my approach until I am actually home. The app does have permission to access location all the time and to use precise location. I was in airplane mode when I reached my destination, but I definitely was not even before I started my journey home. I use Nabu Casa to reach HA. It looks as if the phone is not reconnecting to Nabu Casa until the phone connects to my home network. I did not check the connection status last night, but when I go in and out of airplane mode here it reconnects very quickly.
Ya, doesn’t help, but that was my first thought. Depending when the device gets GPS updates and signal to phone home and stuff, it’s probably a timing thing.
Here is the trace from another trip. The parts before and after the red line correspond to my drive away from home and then back. I believe that my automation would have been triggered this time had this trip occurred after sunset – even though I was probably still driving too fast .
The part above the red line is me walking. The big steps are, of course, nonsense. However, the fact that there are big steps with level portions in between suggests that my phone is not updating my location regularly or Home Assistant companion app is not requesting my location regularly. I have location permission for the HA app set to “Allow all the time” (this is on Android, by the way). I have “Use precise location” set. I have “Allow background usage” for the HA app set to on. Am I missing a setting that could explain this anomalous behavior?
The “near home” zone has been working lately even though nothing that I know about has changed. However, because of the problems I had with zone detection, I thought that I would try adding a test for whether my phone is connected to my wifi network. That test works too, so when I return home I now get an event when I enter the near home zone and another when I am close enough to home to connect to wifi. However, when I performed this test yesterday, I got a warning from Google Fi of a data spike. I suspect that the wifi test caused the spike, but I need to understand better how both tests work. I have 2 questions:
Is it the case that the wifi test operates by sending queries through Nabu Casa to my HA server asking whether my router shows that my phone is connected to wifi? If so, then I bet it makes the request frequently, which would account for the data spike.
Is it the case that my phone knows the definition of the near home zone, so that it can test locally whether the current GPS location of the phone is in the zone? If so, then I presume that the companion app sends a message via Nabu Casa once when it detects that the phone has entered the zone, which would explain why I never got a data spike before.