#Geolocation not working as it should.

1 messages · Page 1 of 1 (latest)

turbid beacon
#

Hi. I'm not sure if this is the right place to post this issue. Please forgive me if not and feel free to redirect me to the proper location if needed.

That being said, I'll try to explain what's going on and I hope to find some help here to get this solved.

In summary: it seems something is really wrong with the geoloaction and I don't seem to be able to pinpoint the root cause.

As we all know, automations based on geolocation is a very powerful tool. But since my geoloaction doesn't seem to work I cannot have any automation based on location.

I have defined a few zones.
Home: the most obvious one
Work: the second most obvious one
Store: the store I visit most often

I have the companion app on my iOS iPhone 12. And all location permissions are set to full acces. Meaning HA app is allowed to use my precise location, always.

I access HA through the Nabu Casa external link to have access to my HA while I'm not on my local network. In fact, I never change this and access my HA via that same link/setup while I actually am on my local network.

And here's the 'funny' part...

For some reason my location doesn't get updated properly. For instance, my current location according to HA is at work, which I'm not.
Further more, HA indicates I was at zone 'work' just yesterday, which I wasn't.
I have been home last night and this morning, but still HA thinks I'm at work since yesterday...
Other times HA thinks I'm at home while I'm out somewhere else. This last situation is the most common one, HA thinking I'm home while I'm not.

Maybe unrelated, but I also want to mention I sometimes access HA from my iOS iPad. I'm not sure how HA makes the destinction between my iPhone and iPad to determine who is who and where I am.
I also access my HA from my homecomputer. Using the same account/user.

Should I use different users on different devices maybe?

Anyone around here who can point me in the right direction?
I'm kind of lost.

Many thanks in advance!

lost rampart
#

A few things you can try:
in HA we have the “person” configuration, where you define people and users from your home assistant server. In there you can choose which device will be the tracked one for each user

#

If that doesn’t work you can try to go to integration, find “mobile app”, find you device and delete the integration entry. Then force kill your Home assistant app in your iPhone and open it again, it will generate a new entry under mobile app

#

If that doesn’t work then let’s try to debug through:
Companion app settings >> Notifications >> Local notification

Enable enter zone and exit zone notifications, and then we will observe if your iPhone is actually notifying when you are entering zones

turbid beacon
#

Ok, great. Thanks for your reply!
I will try your suggestions and keep you posted.

One question though: please correct me if I'm wrong, but as I understand your comment on the 'person' configuration, I should configure a person per device, right?
I'm the only person (for now) using our HA setup. So if I understand you correctly I should create a user/person per device. One for my iPhone, one for my iPad and so on, correct?
My main person/user (being myself) should be my iPhone if I want to track myself. Since I usually have my phone with me.
Then another person/user for my iPad to track the tablet seperately. (Even though I have no use case for tracking my tablet's location in HA as there's no point in that) in order to not confuse HA which is which and who is who.

Is this reasoning correct and the way to go?

lost rampart
#

You don’t need another person for your iPad, we link phones to people because usually where the phone is is where they are, but for iPad you could simple use the “device_tracker” generated by the mobile_app integration

turbid beacon
turbid beacon
#

I deleted them all. Forced app shutdown on iPhone and restarted. the app. Now I have only one listed.
But that makes me think. Why would I have 119 entries? Following the logic that an new entry is made when I force close the app, it seems that it creates a new entry every time I login via the app. Why else would it create 119 entries?

lost rampart
#

There was an issue in the past, perhaps you use home assistant for a while already? This shouldn’t happen again if you are running latest core and iOS app

turbid beacon
#

Weirdly enough, now that I have only one entry in the mobile app migration my location is now 'unknown' and not in the home zone, which I'm currently at.

lost rampart
#

Your person entity or your iPhone device tracker entity? Or both?

turbid beacon
#

aha, my person entity so it seems

#

let me check the device tracker

lost rampart
#

Enable that notification I mentioned on my first message and then observe next time you enter a zone if it will update/notify you

turbid beacon
#

ok, let me check where I can find that setting

#

found it

lost rampart
#

Inside companion app settings >> location you can manually update location, perhaps it updates right away, but anyway, enable the notification and observe the next time

turbid beacon
#

yeahg found it and enabled them. In the app my location is displayed correctly btw

lost rampart
#

That’s just the server name, by default we call it home

turbid beacon
#

oh ok 🙂

#

stupid me

lost rampart
#

Haha don’t worry, in that same location settings, do you see your zones there?

turbid beacon
#

nope

lost rampart
#

One screen before that one

turbid beacon
#

no, that's the screen with the settings

lost rampart
#

My bad, go back one more, then tap “location”

turbid beacon
#

but i see what you mean, its another screen. and yes they're listed there

lost rampart
#

👍🏻

turbid beacon
#

and I have all settings enabled, permission = always, accuracy = full, background refresh = enabled

#

weirdly enough HA still thinks I'm at an unknown location now.
I'm not planning going out any time soon as it's in the middel of the night. But I'll see what happens tomorrow morning when I leave home

lost rampart
#

After that please check if you received the notification and as well the entity state updated

#

Other sensors update correctly right?

turbid beacon
lost rampart
#

Battery level for example

turbid beacon
#

yep all sensors seems to be right. I just plugged it in and the charging sensor updated immediately

#

the only one not correct is the location, which is still listed as unknown? But that might change when I leave/re-enter a zone

#

I just noticed something. A setting which seems to happen automatically

#

The 2 top ones, changed to periodic and changed to signaled. I did nothing to make this happen. Not sure what this means

lost rampart
#

They are what “triggered” the sensors update

turbid beacon
#

oh ok, not important

#

interesting though, now I understand what it means, thanks

#

Maybe I should start moving around so my GPS location changes a bit. Maybe it will trigger my location setting

lost rampart
#

Perhaps reboot your phone, not sure if it will but may work

turbid beacon
#

yeah, I'll walk around to the front of the house, if that didn't trigger I'll reboot

lost rampart
#

I’m heading to bed now, but keep me posted and I’ll take a look tomorrow

turbid beacon
#

Yeah, thanksa lot! Have a good night and I'll keep you posted.

#

rebooting mobile updated my location to 'home' btw. moving around didn't.
Will keep you posted on changing zones.

lost rampart
#

Super!

turbid beacon
#

A short update:
I didn't receive a notification this morning when I left the zone 'home' but I did get one when I arrived back home about an hour ago.
I will check the logs on my location to see whether the exit and entering has been properly logged.

turbid beacon
#

I have checked the logs for my location and something isn't quiet right just yet...

Even though I received a notification on my mobile when I returned home this afternoon, I didn't receive a notification leaving the 'Home' zone.
In the logs I see HA thinks I never left my home (see screenshot below) weird since it notified me when I came back...

I also see HA detected my location at 'unavailable' more than 2 hours after I left home.
I left home at about 9:30 AM and as you can see HA detected my phone at home at 9:41 AM
It then detected my phone at unavailable at 12:29 PM. I was indeed at an unknown location for HA (I was at a none predefined zone between 10AM and 13)
I arrived home at 13h, got a notification, but the log doesn't show that. In fact it detected me at 'unavailable' at 16:02 while I haven't left home since I arrived at 13h.

Weird stuff

#

In summary:
One screenshot (timeline) shows I haven't left home all day since 2AM
The other screenshot (logs) shows I have been at unknown locations and at home on several timings

Reality is that I left home at 9:30AM and arrived back home at 13h

verbal rain
#

iOS only allows some updates a day for HAapp, so it’s usually not accurate.
There’s details in the docs.

quick shuttle
#

Hey all, as OP if this isn't the right place let me know, however I'm having exactly the same issue, and concerned its actually a HA-Core update that's caused it.

Worth saying this setup has worked for over 2 years, with excellent tracking with no issues, so something has definitely changed!

To give some context -
Core
2024.11.1
Supervisor
2024.11.2
Operating System
13.2
Frontend
20241106.2

Apple Devices x2 iPhones - both running latest version of the App.

The apps themselves are both detecting location updates perfectly, I can see from location history they are all correct and updating at regular intervals.

The apps are connected to the HA server fine, I can make changes on the dashboard whilst away from home etc.

But since Sunday afternoon 10th November there hasn't been a Geolocated update for either device in the device history.

I've tried deleting the devices (I didn't have any duplicates anyway), they readded themselves as expected but no improvement.

#

The weird thing is all other changes are being received, and instantly! If for example I start charging my phone, the server knows and updates in the history/logging. It seems like a specific bug with the tracker. And is showing "unavailable" the same as OP.

turbid beacon
#

Adding to my own issue and what Chococookies has posted I'd like to share my latest findings.

I had the notifications enabled as instructed and I do get hem once in a while. Not always, just sometimes.
Sometimes I get a notification when I leave a zone, the other time I get one when I enter a zone. But it's not consistent at all.

Next to that the strangest thing happens: even when I got a notification, still my location isn't updated properly in HA.
Let's say I entered the work zone, and I get a notification, my location in HA is still showing 'Home'. It doesn't make sense at all as the notification is coming from within the HA companion app...
In fact, my location in HA seems to be 'stuck' at home for most of the time. Sometimes it shows 'away', even when I'm at a known zone...

Adding to chococookies' comment: all other sensors work as they should. When I put my phone on a charger, the status is updated immediately, even when I'm not on my local network.
But locations? Nope.

turbid beacon
#

There seems to be no followup anymore on this topic.

inland cargo
#

'poza domem' -> away from home
'IKEA' -> you know

#

And it's doing funky stuff here

#

I've set all 'location' sensor in HA comp. app to have min accuracy of 100m

#

Maybe this will help, not sure

#

Though even from that log i think the automation should fired up, but it haven't

#

In my 'user' tab

#

Those are tracking devices

#
trigger: state
entity_id:
  - person.michal
to: zone.ikea
for:
  hours: 0
  minutes: 5
  seconds: 0
#

And in the automation this is the trigger

#

I don't think from key is necessary, right?

#

Are maybe the for: is not working properly?

#

I have another automation coming home with such trigger:

platform: state
entity_id:
  - person.michal
to: home
for:
  hours: 0
  minutes: 0
  seconds: 0
#

And that is working fine

inland cargo
inland cargo
# inland cargo

One idea, maybe the away from home comes from the wifi tracker, I will try to disable it

#

But seems that it is not the case..

inland cargo
#

Or maybe the 'zone' cannot be a custom zone in case of that trigger?

inland cargo
turbid beacon
#

How does this makes sense?
I get a notification I left Home (which I did) but when I check HA logs, it says it has detected me at home 🤦
Seems like I'm at two places at the same time ... magic!

turbid beacon
#

@lost rampart why is there no followup anymore on this topic? Am I missing something?

lost rampart
#

Please do not tag me on a Sunday, I‘ll check the thread during the week, ping me on Thursday if you haven’t heard back from me

quick shuttle
#

Morning, just to say I updated my Home Assistant to the version released on Friday (which I don't think mentions any fixes to this issue)
But tracking this morning SEEMS to be working

I'm getting geocoded location in the history logs correctly, matched by the device tracker

Obviously not suggesting this is a fix for everyone, but seems weird its now massively improved without any other changes.

lost rampart
#

What have you set as device tracker for your user?

#

Those sensors update? Do they report the right information?

#

Do you still see duplicates in your mobile app integration?

#

Also, going to companion app settings >> debugging >> event log, do you see any error there?

turbid beacon
turbid beacon
turbid beacon
turbid beacon
turbid beacon
lost rampart
#

Based on the event log you dont have the webhook setup properly, first, force close the app, then delete the integration entry.

How is your internal and external url configured? could you provide me screenshots? feel free to cover personal information and forgive me if I already asked before.

turbid beacon
turbid beacon
lost rampart
#

I need the screens from companion app setting >> your home >> internal and external url

lost rampart
#

you dont have any internal url that you want to use?

#

(no need btw, just asking out of curiosity)

#

After you reopened the app, now you see another mobile_app integration entry?

turbid beacon
turbid beacon
lost rampart
#

Ok, do they reflect the truth?

turbid beacon
#

yes it does, but only after I opened the app

#

It wasn't showing the truth, but I opened the companion app again and the sensors updated to show the truth now

lost rampart
#

It won't reflect in realtime, Apple doesn't allow continuous app usage in background, there are certain situation that it triggers the update sensors in background, such as entering/exiting zones and at a certain time interval defined by apple

lost rampart
#

Having said that, can yoi check again your "person" in home assistant to see if the device tracker is there? even better to remove and add it again there.

#

Also send me a screenshot of the event log once more

turbid beacon
#

ok, one sec

#

I removed my device tracker (which was showing the correct device) and added it again.
I cleared the event log a moment ago and here's the screenshot from the log after I reopened the companion app

lost rampart
#

Ok keep an eye on it once in a while, this is the type of log we want to avoid

#

Now lets check your permissions, are you allowing location always?

lost rampart
#

screenshot from Companion app settings >> location please

turbid beacon
lost rampart
#

Location history screenshot

turbid beacon
lost rampart
#

Good good

#

I assume your zone is correctly configured in HA as well right?

#

If you have somewhere you go often, like a supermarket, it would be nice to add a zone for it so it helps us debug

turbid beacon
#

yes it is, I have a few zones defined. Home, work and 2 others

turbid beacon
lost rampart
#

Companion app settings >> notifications >> local notifications

Leave those enabled

#

And then let's observe how it goes from here, keep me posted

turbid beacon
turbid beacon
turbid beacon
#

@lost rampart I'm happy to report that everything seems to be working fine at the moment. I've been away from home, at work and at the supermarket several times in the past dew days. Each of these locations are defined as a zone in HA. And every time my location was updated accordingly.
I also get notifications when that happens. I also get frequent notifications about my location being fetched in the background.

#

Next step is to get my in home locations to work and not interfere with this.
I'd like to get my bluetooth sensors to get my in house locations to trigger automations. Fingers croosed! 🤞