Issue using zone.home as home/away trigger

When I leave my home zone (About a 400ft radius around my house) with my phone it works as expected, e.g., the security system arms. But when I take my wife's phone with me, she always remains registered as being home, or at least I thought. I drove about 3/4 of a mile away, looked at the state of zone.home in developer tools, and my wife's phone was still listed as being home. I tried deleting her phone from HA, and remove HA from her phone, and reinstalled it. That didn't help. Then the last time I tested having both phones with me again I drove about 3/4 of a mile away, and the security system did not arm. UNTIL I started home and I was got closer to my house, then I noticed that it did arm. I disarmed it using HA in Android Auto, and then as I was right down the street from my house it armed again. Meaning 0 phones at home.

Maybe I'm expecting too much accuracy from GPS?

-Thanks

trigger: state
entity_id:
  - zone.home
to:
  - "0"

Can her phone reach HA remotely?

I set it up for remote access, but I'll verify that when I can steal her phone.

-Thanks

I drove about 3 miles from my house and the security alarm did not arm (Which would mean zone.home = 0. Then on the way back about 1 1/2 miles away, the security alarm did arm. I'm tempted to try the parallel and queued modes for the automation.

Subsequently I updated my automation to be conditionally based only on the zone.home entity. As opposed to Karen and or Bernard being home or away. I'll be able to test this fully tomorrow.

alias: NFC - Geolocation Home Zone Test
description: ""
triggers:
  - trigger: state
    entity_id:
      - zone.home
conditions: []
actions:
  - choose:
      - conditions:
          - condition: numeric_state
            entity_id: zone.home
            above: 0
        sequence:
          - target:
              entity_id: input_boolean.security_alarm_switch
            action: input_boolean.turn_off
          - target:
              entity_id: input_boolean.doorbell
            action: input_boolean.turn_off
          - target:
              entity_id: input_boolean.front_camera_switch
            action: input_boolean.turn_off
          - delay: "00:05:00"
          - target:
              entity_id:
                - input_boolean.doorbell
                - input_boolean.front_camera_switch
            action: input_boolean.turn_on
      - conditions:
          - condition: numeric_state
            entity_id: zone.home
            below: 1
        sequence:
          - target:
              entity_id: input_boolean.security_alarm_switch
            action: input_boolean.turn_on
          - target:
              entity_id: lock.touchpad_electronic_deadbolt
            action: lock.lock
mode: restart

What are you using besides GPS?

I've got mine to set up 4 ways for each person for reliability (one android, opne cell phone). Showing as home when you are home is much more imnportant to me (so lights do not go off when there etc.). I use this combo for each person:

GPS
Router (Official TP-Link WiFi integration)
Router (HACS TP-Link integration)
BLE

It takes about 10 minutes of not being home for all four to them finally switch to the phone not being there which is fine with me, my main issue was getting it to trigger as being home the second we arrive. Only after all 4 show as not home then that person entity is shown as not home - because you really know for sure they are not there.

Then when we arrive, before we even reach the door typically the ble triggers first. As soon as any of them show as home then the person is shown as being home.

The above serves us well for our purposes. It works flawlessly (but never for immedately after leaving, as per above, but always becomes correct, 100% f the time). This is the way. Example:

Notes:

HA does do all the calculations for me using it this way and it does it very well.

  1. The BLE IRK I am using is the actual BLE on each phone. Terefore bluetooth needs to stay on on the phones (unless you have a different BLE device on a keychain or the same).
  2. IP address needs to be static. To do so and make it work 100% properly, turn off anonymized mac addresses because most routers assign IP based upon Mac address.
  3. HA must be on each phone with full access rights (location etc.). Annoyingly, apple will very often re-ask the user to verify they want the HA app (or any other app for that matter) to continue to have location access. This does not happen with android. If it is a non-technical spouse, then just explaining it is to ensure the house alarm functions properly.

What I would LOVE would be able to get a notification when the spouse's phone turns OFF location rights for that HA instance. Anybody have any ideas for how to do that?

I was told by someone else in this forum to use zone.home, instead of people. To let HA handle the math and the details. Which is why I came up with this automation based on the zone.home entity. Using GPS worked perfectly for myself, coming and going. The problem started when I installed HA on my wife's phone, getting her phone and mine to work together. I haven't tested the zone.home based automation but I will tomorrow.

I was not aware you could use WiFi and BLE for location trcking. Interesting! I'll have to look into it.

-Thanks

Sounds like an IOS phone.
It is likely phone settings, not much HA can do. if the HA App is installed and allowed to not be put to sleep, and the gps on the phone is working as needed.

1 Like

No it's a Pixel 8. It's my former phone I gave to her. Tonight I deleted the Pixel 8 from HA, and deleted HA from her phone. Then restarted both, and reinstalled and configured. I configured the HA app on her phone with full access. Tomorrow I want to test her phone by itself, and then leave the house with both phones.

1 Like

The state of any Zone is based on person entities' states. If your "people" aren't accurate and reliable, the zone state never will be.

Some users can achieve reliability with just the companion app on their phone, but most get better results with a combination of GPS and stationary trackers. I use something similar to what @KruseLuds described... companion app on our phones, router-based tracker for each phone when they're on home WiFi, and we each have a BLE key fob instead of using the BLE transmitters on our phones.

1 Like

And I thought this would be easy! :slight_smile: Actually, using person.bernard worked perfectly for myself for months, but adding a second phone caused issues. I'll have to look into these other tracking methods.

-Thanks

I hope you said this in jest.

Check the refresh interval setting in the app (if Android has the same setting than on iOS).

You should, because you almost certainly don't want restart behaviour there. Theoretically queued would be the most accurate, if all updates happen strictly in sequence, but then there's reality. Restart is likely your safest option.

I saw that. Good advice.

1 Like

Well, testing my zone.home based automation was a disaster. I drove about 2 miles away, far outside my home zone. The security alarm never armed, or at least HA on Android Auto did not indicate it was armed as it usually does. While 2 miles away I checked the map in HA on my Pixel 10 and my wife's Pixel 8 was still in the home zone. I double checked all of her location settings in Android and HA and they were all enabled. Then when I returned home my wife told me the security alarm went off a few minutes after I left.

The geolocation worked great for me when the Pixel 8 belonged to me and was the only phone setup in HA for geolocation. Then I gave the Pixel 8 to my wife and got a Pixel 10, and have had numerous issues ever since both phones were configured for geolocation.

Update: After I arrived home I was looking at the map in HA on my phone and for a split second I saw my wife's Pixel 8 phone was outside the home zone. Then sprung back inside the zone.

Go to your History dashboard on HA and add the device, person, location, SSID and other location- or network-related entities so that we can see what happened when. Also provide the times and traces of when the automation triggered.

Thanks, that is useful to know, how to use the History feature. I've started working on it.