Help with Zone Radius

Hi,

I’m a newbie to HA and would appreciate help with a problem I’m hitting with the zone radius of my home:

After noticing that the default 100 mtrs radius caused HA to log me as ‘at home’ from too far a distance I found that I could change this within Configuration, Customizations. I’ve also added the necessary line into my configuration.yaml file to include the customize.yaml file.
Following a re-boot the reduced radius surrounding my home location was clear to see within Configuration, Zones so I assumed the problem was resolved.

Unfortunately my HA still seems to be behaving as though the boundary is 100 mtrs, not the reduced one of 25 mtrs. The GPS details are being tracked from the IOS mobile app on my iPhone.

Would really appreciate help in getting this sorted as it’s preventing me applying some automations based upon if I’m home or not.

Just a thought … could it be something in the IOS App that needs updating/resetting/enabling since it is presumably the App that reports your location back to HA.

I use the Android App and also changed by radius to 25m and this seems to work fine.

1 Like

Hi Mark,
Many thanks for your suggestion and it’s interesting that a similar radius change works fine with your Android App so it gives me confidence that Home Assistant can work in this way.

On my iPhone the settings against Home Assistant are set to “always allow location access” plus the “Precise Location” control is set to on.

I’m not aware of any other settings I could check / change but I’d be delighted to hear from other iPhone IOS users.

I don’t know if anyone else can offer any advice on resolving the problem that I’m having with HA’s home location / GPS on my iPhone?
Up to now I’ve been really excited about using HA going forwards but if it cannot determine if I am home or not it’s usefulness is seriously limited and perhaps it’s time for me to take a look at openHAB?
I have even deleted the mobile app off the iPhone (twice!) along with removing the mobile app integration out of my HA followed by re-boots / reinstalls. As before changes to the radius around my home (to 20 or 25 mtrs) followed by a re-boot of HA are correctly indicated on the map (Configurations, Zones). However on leaving the house this only gets flagged up after quite some distance (around 100 mtrs) when walking and even more frustratingly it’s now saying that I’m away when back in the house!
I’m beginning to wonder if the iPhone app is only updating (pushing) the GPS coordinates occasionally?
Are the time / GPS coordinates logged anywhere in HA & be viewable as these details might yield some clues to the cause of the problem?
As an alternative to GPS I’ve even tried using the Unifi integration to use the fact that my iPhone is logged onto my domestic WiFi as an indication of being home. This works very well for arriving home but, frustratingly, the Unifi controller seems to ‘hang on’ to devices that have gone out of range for another 10 mins.
I would really appreciate any help in getting the GPS / home location reliable before I finally call it a day for Home Assistant and look elsewhere.

It does not sound like your app is behaving normally. A rough outline of things to look at:

  • When you disable Wi-Fi, you are able to connect and interact with your HA from within it?
  • Are there any errors in the Event Log in App Configuration?
  • Is your phone actually set to Always permission? iOS tends to both prompt you to downgrade to “While in Use” and will lie to the app occasionally about its permission level. Usually this is the case on a fresh install and then it goes to the right value.

The iOS doesn’t determine home or not home status, it sends up GPS coordinates at certain times. The big one is when you enter or exit a zone. If you are entering or exiting without cellular coverage, it’s likely it will not be able to update until you change cell phone towers after roughly 500-1500m.

If you are seeing accurate GPS coordinates but not correctly in or outside the zone, there’s likely either a conflict of overlapping zones, or some other issue unrelated to the app.

1 Like

Many thanks for all the pointers.

Yes, I can interact with HA when I disable Wi-Fi (using 4G) as I’ve set it up with SSL using the DuckDNS service.

Ah, I wasn’t aware of the Event Log in the App. Very interestingly mixed amongst the ‘updated location’ events there are also errors in the log such as:
“Didn’t update: location update from the past”
“Significant location change detected”

So, thanks for pointing me in to look at this as it certainly looks significant.

The location settings for Home Assistant are set to Always & I’ve also got the ‘Precise Location’ option selected.

I realised that it would be the GPS co-ordinates received by HA that determined whether I was inside or outside the set zone.

My home has good 4G coverage but that’s an interesting point regarding the towers and their spacing. In case it helps most of my observations regarding the problems with the area have been made whilst walking not driving.

I’ve just been digging a bit deeper and discovered that I was able to use three different entities, which all sound similar, to use for tracking my location. Further checks revealed that two are from the Unifi integration, so I’ve made sure that I select the one from the mobile app:

device_tracker.johns_iphone Ubiquiti UniFi
device_tracker.johns_iphone_2 Ubiquiti UniFi
device_tracker.john_s_iphone Mobile App

Another observation is that looking at the map a few minutes ago it indicated that my mobile phone was a significant (about 50 mtrs) away from the location of my house. Is it possible that the alignment of the houses / road layout on the HA maps has ‘drifted off’ quite a bit? To test this out I re-centered my home location where it indicated my mobile phone location to actually be and took a brief walk. I kept the HA mobile application ‘live’ during my walk (& on 4G). On return the location where my mobile is indicated is far nearer to it’s actual position on the overlay map.

The relevant entries in the App Event Log read:
19:52:18 Application Starting
19:52:18 Didn’t update: location update from the past
19:52:21 Ending monitoring [email protected]
19:52:21 Ending monitoring [email protected]
19:52:21 Ending monitoring [email protected]
19:52:21 Initially monitoring [email protected]
19:52:21 Initially monitoring [email protected]
19:52:21 Initially monitoring [email protected]
19:53:54 My Home exited
19:53:54 Updated location
19:55:25 Didn’t update: location update from the past
19:56:38 Didn’t update: location update from the past
20:04:26 Didn’t update: location update from the past

So it certainly could be a problem with the frequency the app can update HA

I’ve just been digging a bit deeper and discovered that I was able to use three different entities, which all sound similar, to use for tracking my location. Further checks revealed that two are from the Unifi integration, so I’ve made sure that I select the one from the mobile app:

Make sure your ‘Person’ entry in HA’s Configuration only includes the mobile_app tracker; if your other ones are providing contradictory signal, it’s very possible they are contributing to any problems.

19:55:25 Didn’t update: location update from the past

This particular log entry is usually benign; the system will often tell the app about a location change event which occurred in the past; it’s nearly always something we want to ignore as other signals are better. To try and keep the location handling code as simple and straightforward as possible, every incoming event gets logged in some way which includes these not-so-useful ones.

Another observation is that looking at the map a few minutes ago it indicated that my mobile phone was a significant (about 50 mtrs) away from the location of my house.

The app’s focus is around accuracy about position in and out of zones, but not so much about the accuracy of locations within those two buckets. As long as your GPS location is “within” the zone (central latitude/longitude ± its radius) the app is happy to not spend battery on these updates.

It does look like your zone is configured to be <100m. At this small of a radius, the app needs to create overlapping regions to watch (that’s the @000, @120, @140 monitoring) so I would expect your location to often be at the intersection of those regions.

If you tap on many of the location-based event log entries, you should see some additional information like the exact GPS coordinate that the app sent as well as any reasoning behind unsuccessfully updating. So if you tap on your “Updated location” next to the “My Home exited” I would expect the coordinate sent to be ‘outside’ the zone.

1 Like

Again you are absolutely correct. The additional information:
{
“start_ssid”:“none”,
“event”: “ZoneManagerEvent(region(CLCircularRegion (identifier:'[email protected], centre:,radius:100.00m),outside), zone.home)”

The problems with getting my iPhone GPS to work correctly to determine if I’m home, or away, continue:
This afternoon, after returning home from a 8 Km walk, HA still showed me as being ‘away’. Looking at the reported position of my iPhone on HA’s map it is at least 30 Mtrs away from it’s actual position as determined by the buildings / roads map overlay.
However HA classified me as being at home before I started the walk?
I’m starting to think that HA is only designed for people who live in the middle of an empty field who have the ability to leave the radius of their home at the default 100mtrs (I’ve reduced mine to 25 mtrs which I consider should be accurate enough given modern GPS technology).
Whilst out on my walk I did track progress against my Apple Watch and, rather frustratingly, the entire path is viewable & accurate to within 5 mtrs (or probably less).
Why HA seems incapable of reliably & accurately using the iPhone GPS data is a real mystery to me.

A few more observations with the ongoing problems with the iPhone app GPS & my Home zone:

After arriving back home from a walk yesterday around 15:52 Home Assistant continued to mark me (incorrectly) as being ‘away’. Almost 3 hours later, at 18:41, with no known changes made by me, it then appears to have (correctly) set me as being at home.

Today I went for another walk:
I left home @ 13:06. HA flagged that I’d left approx. 2.5 minutes later.
I returned @ 13:49. Initially HA still showed me (incorrectly) as being away but then eventually, approximately 52 minutes later, it decided (correctly) that I was home.

I am at a complete loss to understand this erratic behaviour and wonder if there are any resets with the app, or main program, that I could try to get it sorted?

Can you compare the things happening in the event log with your observations? This is the only real way to try and understand what is going on.

Do you really think hundreds of thousands of people would be using Home Assistant if it was incapable of accurately detecting whether people are home or not? HA knows when I leave the house within 1 minute, and it detects when I’ve come home within seconds. Always.

The problem lies within your configuration or equipment, not HA so please stop complaining about it. Your GPS isn’t going to update any faster in openHAB. Sometimes it can take a little fiddling to get it the settings right, but once you do it usually works great.

I personally use the composite device tracker with bluetooth, ping, wifi, and gps sensors. But there are many methods of presence detection that can be used. Putting multiple trackers in your Person configuration is a good start. Unfortunately (well, fortunately IMHO) I’m on Android so I can’t really help you with the iOS end of it.

But the first thing I would look at is if you’re in battery saving mode or optimization or whatever ios calls it. That slows down your GPS updates. I’d also check to see what your minimum accuracy for GPS reporting is. Make sure it the same or close to your home radius.

Here’s what the companion docs say about ios location tracking.

The Home Assistant Companion App receives significant location changes from iOS. Whenever an update is received, it is sent to Home Assistant. Roughly, an update is received every time that your device transfers to a new cellular tower, a significant amount of time has passed (usually a couple hours) or a connection state changes and the system notices your location recently changed.

So multiple trackers (ie bluetooth, ping and/or wifi) sounds like it might be a good bet for your situation.

Hi Jason,

Thank you for your response. Firstly, I would like to confirm that I do want to continue using HA since overall, I have been extremely impressed with it. In particular the vast library of integrations which allow simple device adoption and add-ons such as InfuxDB & Grafana to allow data capture & display. I recognise that HA is under continuous development and I would like to pass on my total appreciation to the entire software development team for doing such an amazing job.

Whilst still in my experimental learning stages with HA the one over-riding factor that I cannot overlook (at my peril) is the end goal has to be a system which meets with full wife approval. This basically means both total reliability and simplicity to use and, wherever possible, automations which minimise the need for user intervention. Thus why presence detection is key to any setup.

It’s interesting that you along with Jonah1970, another Android user, don’t experience any problems with the mobile app with respect to GPS positioning. I was hoping that iPhone IOS users could confirm that it works equally well for them.

I agree that the root of the problem probably lies with my configuration and, as a newbie, I am keen to investigate every option to try and both identify & eliminate it. To try and get matters resolved I did a full reset on the mobile app earlier today, deleted it, and reinstalled / set it up once more. Alongside this I increased the radius ‘around’ my home to 40 mtrs and re-booted my HA instance. After doing this I went for a walk. I was correctly logged as being ‘away’ after a few minutes but, as previously, HA didn’t log me back upon my return. After being home for a couple of hours I checked out where my iPhone location was showing on the map and it was around 60 mtrs from it’s ‘true’ position (as identified by the building / road overlay).

If, as the companion doc states, the app sends an update on a change of connection state does this not include going from 4G to domestic Wi-Fi?

I’ve checked all the settings I can find in IOS:

Location permission is set to ‘Always’
Precise Location set to ‘On’
Location Accuracy is set to ‘Full’
Motion Permission is ‘Enabled’
Background Refresh is ‘Enabled’

Having done some research I am aware that HA users have previously used programs such as Life360 to provide GPS positioning data but I was under the impression that recent development of the app had made such bolt-ons more or less unnecessary?

I have looked to alternate methods of locating when I’m actually home – in particular using the integration of my Unifi network to determine if my iPhone is on/off the Wi-Fi network. In fact this works very well for arriving back home but due to the ‘sticky’ nature of the Unifi controller in releasing clients it’s around 10 minutes before departure out of the Wi-Fi area is flagged. I have separately asked within the Unifi community if there is anyway of avoiding / reducing this latency.

I can certainly see that a hybrid solution of multiple trackers may be necessary - certainly for determining absolute position once very near or inside the house perimeter so many thanks for the link to the Composite Device Tracker. However, and apologies if I’m missing the point, I still fail to understand why my iPhone / Apple Watch setup will accurately track my walks to an accuracy of only a few metres but the mobile HA app seemingly doesn’t broadcast the coordinates until triggered by connecting to a new cellular tower. I realise that this is probably done deliberately to minimise battery drain but it would be great if an additional control could (assuming this isn’t blocked by Apple in some way!) be provided within the IOS app to send coordinate updates more frequently.

I would start by adding bluetooth tracking, and.or ping tracking, and as you mentioned WIFI tracking (I also us Unifi and yes it takes a while to release, as many wireless AP’s do). That’s why I double it up with the ping sensor which is almost instant, as is bluetooth.

Using the combination of trackers with the composite device tracker has served me very well. Although I will say that with recent improvements to the Android app the GPS is almost instant also, so it’s probably overkill redundancy at this point. But one nice thing abut using BT/WIFI as redundant tracker is if your GPS location gets turn off on your phone your presence coming and going still works though. You can also look into tile like BT devices for your keychains and whatnot, but I’ve personally never found it necessary.

As for the PAF (Person Acceptace Factor) - don’t hook up anything mission critical to presence detection until you have it working smoothly. Trust me, it will save you a lot of headaches.

BTW - If it makes you feel any better I’m over 3 years in and still tinkering!

1 Like

Hi Jason,

Many thanks for those excellent suggestions. I am certainly interested in setting up the ping testing. Have you set up yours up using your Unifi kit or via your HA host? (I’m using a VM running on a Synology NAS). That’s a really good point about the additional resilience provided by BT or ping location tracking!

I’ll certainly heed your words of wisdom regarding PAF – that’s one ‘place’ that I certainly don’t want to go!!!

Although I’m only just starting out I’m recognising the value of this forum, especially with the benefit of people like yourself being able to provide guidance from your personal >3 years of experience.

More for Zacwest I did some more checks this lunchtime.
Before leaving the house I manually set three parameters for the home location:
Lattitude (value obtained directly off the map application on my iPhone)
Longitude (value obtained directly off the map application on my iPhone)
Radius (Set to 60 Mtrs)

After setting them I did a full re-boot of HA.

After a walk of around an hour duration I returned. When I was approximately 100 mtrs away from home this proximity seemed to be flagged up correctly by an alert to my iPhone. However, on getting back I was surprised to note that I was still regarded as being ‘away’. Checking through the message logs (see below) I am even more confused as it clearly says ‘My Home entered’ but does not show any leaving home message.

In case it’s relevant I should add that my house is at the end of a cul-de-sac therefore I walk around the periphery rather than a direct walk towards it.

Time Message

12:47:48 Updated location
12:52:47 Significant location change detected
12:52:47 Updated location
12:59:26 Didn’t update: Location update from the past
12:59:26 My Home entered
12:59:26 Updated location
12:59:49 Significant location change detected
12:59:56 Updated location
12:59:56 My Home entered
12:59:56 Updated location
13:00:16 My Home entered
13:00:16 Significant location change detected
13:00:16 Updated location
13:00:16 Updated location
13:09:21 Didn’t update: Location update from the past
13:12:33 Didn’t update: Location update from the past
13:12:58 Application Starting
13:12:58 Didn’t update: Location update from the past
13:18:07 Didn’t update: Location update from the past
13:25:15 Didn’t update: Location update from the past
13:51:48 Didn’t update: Location update from the past

I’m certainly beginning to think that the problems that I am experiencing with positioning are in some way due to the mobile app not updating the GPS coordinates at sufficient frequency. For information it is an iPhone Pro 12 running the latest (v14.4) IOS. Unfortunately, I don’t have any access to an Android device to allow comparison on that platform.

If you tap into the updates that occurred (the ‘Updated location’ events) are they within your zone as expected? If so, please compare the device_tracker itself and your person – if you still have any additional device_trackers connected to your person it would provide incorrect results.

Thanks zacwest
By the way my system finally acknowledged my return home at 14:29:57 which was approximately 1.5 hours after I actually got back.
This ties in with the companion docs explanation of IOS location tracking:
“…a significant amount of time has passed (usually a couple hours)”
There are a couple of log entries at 14:29 :
14:29:57 Current location delivery triggered via background fetch
14:29:57 Didn’t update: ignoring during one shot

The details contained within the background fetch entry include:
vertical_accuracy: 10
gps_accuracy: 65

The additional details within the ‘Updated location’ log entries around the time I actually arrived home (12:59) do imply that they are within the expected zone.

I guess until any changes are made to the iPhone app which would allow the frequency of broadcasting GPS coordinates to be increased my best bet is to concentrate on alternate location detection as suggested by Jason.

I do not that describes the state of affairs. For example, an accuracy of 65m while you are <= 65m away from the border of the zone is still considered ‘inside.’ 65m is also the accuracy the system will state for all Wi-Fi-based location pulling.

If the “Updated Location” log entries look correct (their GPS position is ±accuracy away from the zone±radius) then I believe you’re either looking at a person entry composed of multiple device trackers (and they disagree), or something else is going on. Please take a look at your person entry and verify the device trackers inside, and please look at the device tracker directly to see if its state is correct vs. your person entry.

I do not believe the frequency of updates is an issue in this particular thread as your locations seem to be correct at the time they are recorded.

1 Like

There is only a single entity ID associated with tracking my person ID:
device_tracker.john_s_iphone_2
Checking within Configuration, Entities this is associated to the Mobile App integration.

I note that the current reported accuracy is also 65m - which is correct since the iPhone is now on my Wi-Fi.

I’ve also checked & can confirm that the device tracker details do mirror my person entry with respect to the times showing when home or away.

Whilst on my outdoor walks I also log my progress using the Apple Workout app on my Apple Watch which is directly associated with my iPhone. This allows me to view the full course of my walk and I can see that the plotted track appears to be very accurate. Is it possible that this is, in some strange way, affecting the HA GPS readings?

Many thanks to you for all the assistance in trying to resolve this mystery.

If the device tracker and your person entry agree, but their state is incorrect, then it does sound like something is wrong.

It would be helpful to make a table of something like…

Date GPS Accuracy
(timestamp the entry occured) (the coordinates) (65m accuracy)

In addition, knowing the GPS latitude and longitude of your home zone and its radius would be useful. From this we can calculate “expected distance” and “expected state” – you are in a zone if:

  1. no smaller zones that may apply
  2. your gps±accuracy is within the zone_center±radius, and
  3. that zone is not set as ‘passive’ and is not ‘unavailable’.

That logic is done here.

Also worth noting: if you change your zone configuration, you must launch the app before doing location changes for it take effect. The app does not constantly watch your location for these breakpoints, it sets up regions when it loads the new configuration.

1 Like