Person not updating as expected (GPS + Router)

I have a person.david set up with two device trackers associated with it.

  1. david_s_phone (router)
  2. moto_z3 (GPS thru HASS app on my phone)

The bar for david_s_phone is correct for when I was home/away. The Moto Z3 bar shows me as home all day because I deliberately did not connect to my VPN so the app was never able to update with my GPS location.

What really confuses me is that the person.david shows me as home all day It only looks at my GPS tracker (which wasn’t able to update as soon as I left my home WiFi) and completely ignores my stationary router tracker. Even though my router was the most recently updated as correctly showing me as away. It’s my understanding that when there are stationary (router) and GPS (my phone’s app) device trackers, that the most recently updated tracker will be used for updating the person entity. But clearly this is not happening!

What the heck am I missing here?! And how can I get my person.david to correctly update while using both trackers?

It does look like you’ve found a bug, since that’s not how the integration documentation says it should work:

  1. If there are trackers of type gps , then the most recently updated tracker will be used.

Please open an issue.

I would disagree that this is a bug. The gps tracker shows him as home all day, so the person is home all day.

He only has one GPS tracker so that is, by definition, the most recent GPS tracker and its state was used to determine the state of the person.

A failure of the gps tracker updating due to being deliberately blocked from doing so by a user is user error, not a bug in the system.

See, I read it as the most recently updated tracker meaning any tracker, not the most recently updated GPS tracker. That’s how the example reads to me too.

Yes Tinkerer I agree with you. The example is what got me to believe something was actually wrong. It looks at all device trackers and the stationary trackers get priority over GPS.

I’ll open an issue. Thank You!

If you change this behaviour then you can expect to wake up in the night to all your house lights being on.

You will come home at 5pm from work (last update of gps tracker), go to bed at 10 and at some point overnight your phone will drop off your network for a few seconds.

Currently the system knows you’re still home because your GPS tracker hasn’t moved. Your suggestion is to mark you away, and then 20 seconds later when it reconnects mark you as back home, thus initiating all your ‘arrived home’ automations.

This is a bad move.

The real question is: what’s the point in having a gps tracker attached to your person entity if you’re going to deliberately block it from updating homeassistant?

You did read the integration page? To summarise:

If any tracker shows you home then you’re home

Exactly, and in this case the gps tracker shows him home.

Quote from the link you put in your post…

“In short, when you’re at home, your position is determined first by stationary trackers (if any) and then by GPS. When you’re outside your home, your position is determined firstly by GPS and then by stationary trackers.”

So it first looks at his network tracker which is not_home, then it looks at his GPS tracker and that is showing at home. So he’s home :man_shrugging:

This is user error, not a bug.

This is why I don’t use person :smiley:

I still think this is a bug. It’s not unknown for apps to be killed, phones to be put into aeroplane mode, run out of battery, etc. Having the most recent updates for the stationary tracker ignored because 8 hours ago the GPS said you were home… that’s broken. Your interpretation is also valid, and appears to be how it’s coded.

That could happen whilst you’re at home too, so all those things are out of homeassistant’s control. Homeassistant can only work on the information it is provided. In the same way as if the weather service accidentally sends my homeassistant the weather for Saudi Arabia instead of my local weather homeassistant has no way to know that the data it is dealing with is erroneous and so would react to the forecast it was given.

The ‘example’ on the person page is still correct too, the second step states that the gps tracker has moved, and had it done so the rest of the example would have been the behaviour seen by the OP. But the OP never gets to step 2 of the example because his GPS device tracker never moves.

Well this is where “consider away” interval comes into play so only long network interruptions do that but yea I guess that makes a good point.

And I did this to test/troubleshoot why the heck my person entity wasn’t working. Really I probably wouldn’t have ever noticed except for whatever reason my openvpn app won’t connect until I open my phone (tasker automatically initiates the VPN as soon as I disconnect from WiFi). Still need to figure that one out.

Yes, many times. Probably too many I guess because I ended up confusing myself. Got hung up on “stationary trackers take priority”.

What do you use instead of person?

And this was exactly my thinking.

Thank you all for the help.

A door sensor, automations, and input booleans, as covered here. What I’ve done could be easily simplified - this is complex because I use multiple stationary trackers.

The short version is that:

  • I don’t use GPS for home/away, but purely the stationary trackers (but see below)
  • Leaving home:
    • Door sensors are used to indicate if it’s possible for anybody to have left (so no false aways even if the phone dies)
    • Once the majority of the stationary trackers show not_home then the person is marked as away (assuming an exit door recently opened/closed)
    • GPS location is used as an override to the door logic if it shows us as being far away (this is to handle the all t0o common case of stopping outside the front door for a chat with a neighbour)
  • Arriving home:
    • Door sensors are used to indicate if it’s possible for anybody to have arrived (to handle the all too common case of stopping for a chat with the neighbours before actually coming home - it’s also just possible to connect to our WiFi from theirs if you’re in the right place)
    • If multiple trackers show home then that overrides the above

This evolved over many months, identifying things that’d break the logic and then tweaking it. It started a lot simpler :smiley: