iOS presence detection WITHOUT HomeKit component or HA app (totally native)

How do you deal with the device_tracker changing to not_home whenever HA is bounced (i.e for a configuration change)? i was using the homekit bridge version of this and was able to perform an automation that would re-set it to home if the person is home via another tracker when HA starts, but i can’t figure a way to do it with this method.

That’s a good question, that I don’t think I’ve had to deal with before. I use the person component that combines the iOS webhook call and a Unifi device tracker, like below. I honestly just trusted the HA devs to have the right logic, and they seem to have done a very smart job. I just read through the linked page for the first time and the logic makes sense to me.

person:
  - name: Zac
    id: zac_presence
    user_id: xyz
    device_trackers:
      - device_tracker.zac_iphone
      - device_tracker.zac_ios_shortcuts

i can confirm that it works for person as well as long as you have some sort of tracker of router type.

Since iOS 16.x I see sometimes that our iPhones (me and partner) suddenly outside the home range a poited (gps) even they connected to WiFi. After 1-10min they point again inside the home range.

I have now put a delay in HA before the automation change us from home to not_home.

Still not found why our phones are out of range (100-150m away) and still not solve it…

Before 16.x it was so stable…

1 Like

Since the 2023.5 update, I got an alert that I needed to update the web hook automation. Looking at the docs I’ve set local_only: false so that it reacts when I am away from home and not on my wifi, and added the POST option. Here is my full automation :-

  alias: 'iOS Shortcuts Webhook (presence)'
  trigger:
    - platform: webhook
      webhook_id: ios_hook_neil_tracker
      allowed_methods:
      - POST
      local_only: false
  action:
    - service: device_tracker.see
      data_template:
        dev_id: "{{ trigger.json.tracker_name }}"
        location_name: "{{ trigger.json.location_name }}"
        gps_accuracy: 50

2 Likes

Thanks for catching this. I’ve yet to upgrade to May’s release but was about to! I’ll edit the post as well.

1 Like

Still the best working method for me. However I added a slight delay in the shortcut on my iPhone to accommodate for short disconnects and changes between my two wifi networks.
Also I would recommend using a input Boolean helper in HA to store the state as home or away as the genererated tracker won’t retain its state after HA reboots.

I’m glad it is still working well for you! I agree, this bit of presence detection (for me) has fallen into the “it’s so reliable I forget it exists” bucket. I’m honestly appalled I posted it in 2019 and it’s still what I use :joy:.

I have absolutely noticed the rebooting issue, but I solve it by using the person platform. I mentioned how I do that above: iOS presence detection WITHOUT HomeKit component or HA app (totally native) - #42 by zacs

I considered this, sadly the other trackers associated with the iPhone (location from the app and such) prove to be too unreliable in my case … sometimes it will only update 6 hours after I left home. And since neither is stationary I fear that it would update the person tracker with „away“ after a reboot when using the shortcut.

1 Like