Automation - entry into zone - does not trigger

Hey everyone,

Not sure where to post this. Not sure what frontend" means exactly, and cannot find a category called “automations”, so very unsure. I hope this post finds its way to some good samaritan :slight_smile:

I am very new to HA, and have limited knowledge, so please consider that when responding.

I have this version installed:

I am not sure if that info is enough for someone to know what’s going on, so, some more info: It is installed as a VM in Oracle Virtualbox, on a Debian 11 OS. The system seems to run, and most things appear to be working well.

I have installed Google Assistant SDK, so that I can use a text field to give a “command” to my Google Home products, and this works lovely.

I have the companion app installed on my Android (Samsung Galaxy S23 Ultra), and on my wife’s Apple 'whatever" ( I think it is a 10 XR or something like that). The companion apps work, and I can control HA from the phones.

I have HA Cloud account up and running, and can access HA from outside and inside my LAN, and HA also “sees” both phones and their locations.

My problem is an automation based on location. It is set to trigger when either my phone, or my wife’s phone enters the zone (this being our home). It has a condition: check if the garage door is closed. If the garage door is open, it ignores the triggers. If the garage door is closed, then the action runs: open the garage door. Below is an image of the automation, and below that is the YAML version of it.

So, when I leave, and return, the garage door opens (based on my phone’s location). When my wife leaves, and returns, it just gives her the finger! :slight_smile:

Now, I have checked that HA actually “notices” the location of the iphone. And it does. See image below:

Obviously I have set every possible parameter on the Apple to allow location, for the phone, in sleep mode, in resting mode, in battery saving, for the HA app, etc etc etc, and, as mentioned, it does appear that HA “sees” her phone leave and return. And yet, the garage door never opens when she returns.

So, after that short novel, could anyone comment or advise on whet I should be trying next?

Any help would be much appreciated :pray: :+1:

Maybe just one other image confirming my suspicion that HA “sees” her return:

Are you sure the wife’s iPhone tracker entity_id is correct in your trigger as it’s a little different to the other sensors?

Two others things to check.

  1. Does the time that her presence changes march with the physical event? I’m guessing yes.
  2. From the automation, are there any traces.for when she arrives?

Ah, you see the value of rubber-duck programming :slight_smile:

After posting this, I read through it again, and noticed there is an extra “leana” at the end of her sensor. I think I may have, at some point, accidentally placed that there. :man_facepalming:

I removed it, so that the sensor only says device_tracker.leana_s_iphone thus removing the “leana” which I think I typed there.

Will see tonight what happens :+1:

Thanks for highlighting that as well :slight_smile:

  1. The reported time does seem to match her actual arrival, BUT, I have not checked whether it updates “at that exact time”, or whether it is a delayed report, only being presented after her arrival.

  2. That is actually something that I have not checked yet. Will do. :pray:

To those who read this, please advise:
Should I do a new post with the below info, or should I just keep it here? What is the “best practice” for these forums relating to such?

Hey everyone. First off: thanks for those commenting and making suggestions. For a noob like me, this means the world!

So, the issue was my typo on line 9 of the YAML. The device should not end in “leana”. That may have been an accidental entry that I typed while messing with the code. I’ve fixed that, and now it seems to work.

Well, I say “work”. If I let my wife sit in front of the garage for about 90 seconds to 3 minutes, it works.

With my Samsung, the door is always open by the time I reach the garage (or, at least, busy opening). With her iphone (ah, the joys of the Apple users!!!), it seems to be slow/late. She needs to stop at the door, wait a while, and then the iphone will notify HA “when it is good and ready”. I have done this while actually having HA open and checking when it updates in the logbook. And, sure thing, only once we have stopped in front of the garage and waited a while, does the logbook show that she has entered the zone. And, obviously, once the logbook shows this, the door opens.

The radius for my home, in HA, is about 100 - 200 metres. When I check on her iphone, in the HA app, it appears to be set at 100m exactly. This is not an editable setting on the iphone in HA. I assume that is only editable when I setup the zone/location?

Anybody using iphones who knows what this “wait until the iphone decides the time is right” thing is, and if there is a way to correct/update/address it?

Help appreciated.

Not an iPhone user but battery optimization is the first thing that comes to mind. Second would be location accuracy (maybe it’s not updating until she connects to WiFi?).

I would double check her iPhone setting to make sure background app refresh is enabled, precise location is enabled etc.

home assistant companion app location setting:

iPhone app settings:

And finally iPhone app location settings:

Will check for this. Thanks :slight_smile:

1 Like

These settings look like what I have (by now) memorized from her phone :slight_smile:

But, thank you for this, I am going to compare it to hers, setting by setting, to make very sure they are definitely setup exactly as these.

Just a quick response to all again:

Thanks for the input and advice. Much appreciated.

The day after my final post, all seemed to start working fine.

Our assumption is that the day we were trying it, and the day I placed my last post, it WAS actually working - just very slowly, and we believe that was simply because there may have been some issue with our internet. The Samsung did work 100%, but, in defense of the Apple…we did experience internet issues later that evening, and discovered that there was some connectivity problems. We reported it to our ISP, also restarted our router. The next day, no more internet issues, and since that day, the automation has been working just as well as the Samsung.