HomeKit as a Presence Sensor

I am seeing the same thing. Used to be rock solid, now very hit and miss

Crossing fingers, since the 14.2 iOS update, as well as the 14.2 TV OS( I use an AppleTV 4K as the ‘hub’ always inside the house), presence sensing has been good for the past 24 hours.

I just configured this and it seems to work pretty well. Just one miss so far, and it looks like that was due more to my garage state getting stuck in HA.

So far so good, we’ll see how stable it is over the next few months.

So I’m looking at this to just remove the need for two apps to poll my location. Is it still working good?

I figures that Homekit/Apple polls locations every now and then anyways it could save one some battery to just disable location in the HA app and only use the homekit one.

It is now working good for me. The problem I had a few months ago was that my street address did not match 100% what apple had as my street address.

I just read this thread and had to give this one a try! As of now I used OwnTracks for presence detection which basically works well, but sometimes the location stucks for hours. Homekit as an alternative sounds very promising.

So I created an input.boolean to act as a switch and configured an automation (in Homekit) to turn on the switch when I arrive, vice-versa when I leave. I also created a binary.sensor to use it for an automation. This automation created a device_tracker entity which gets updated via the below automation.

alias: Update presence and device tracker Andreas
trigger:
  - platform: state
    entity_id: binary_sensor.presence_andreas
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: binary_sensor.presence_andreas
    from: 'on'
    to: 'off'
condition: []
action:
  - service: device_tracker.see
    data:
      dev_id: tracker1
      location_name: '{{ ''home'' if is_state(trigger.entity_id, ''on'') else ''not_home'' }}'
      source_type: router
mode: queued
max: 10

the issue
I noticed that when I restart Home Assistant on my Raspi the state from home switches to not home.

question
Has anyone else observed this behaviour, if so what can I do to change it? I couldnt find a solution during internet research.

all the best

Andrew

Just a guess. You said:

So I created an input.boolean to act as a switch and configured an automation (in Homekit) to turn on the switch when I arrive, vice-versa when I leave.

Do you have an entry of initial: in the input boolean? If so, remove it completely.

thanks for the reply, I created the input.boolean via the helper section within Home Assistant, unfortunately I cannot set the initial_state there. AFAIK the intial state is optional and not set by default. Also the automation doesnt contain an initial_state.

as of now I created a flow with Node-RED to check if my binary.sensor is on, but I am marked as not_home. If so it updates the status accordingly.

Can someone tell what the default radius is that homekit used before someone is arrive or leave?

I cant find that info anywhere but if you create an automation you can enter an address (instead of private) and then you can adjust the radius. the smallest one is 100m or around 330 feet. attached a screenshot how it looks like. I think the default radius is 100m/330 feet.


1 Like

Same here.

And this is what I do also, but using the HA automation instead of Node-Red.

sorry to revive an old thread, would you be kind enough to share your automation to re-set the status. i was trying to use device_tracker.see, but i can’t seen to get it to fire.

Is the issue being the automation not being able to be triggered?
Use Home Assistant trigger type and start event, to trigger your automation.
I then added a delay of 1 min (action type: wait for time to pass) - might not be required; you can tweak this
And then, yes, use device_tracker.see under the call service type.

1 Like

d’oh, i was trying to trigger on the state of the binary sensor, but since it doesn’t change, it wasn’t triggering. thank you!

I am biased, but the way I described in this thread is by far the simplest. It doesn’t require the HA app and it doesn’t even require you to be using the HomeKit integration. It does require a hub like an AppleTV though. If you use this you will just end up with a device_tracker and no binary sensors or any “middle man” entities.

2 Likes

i was just reading that thread and was going to try it out as well. Thank you for posting this!

1 Like

anyone else having issues with the location re-setting to not_home. i was working on some automations today and did a few restarts. at one point i checked the status of my device_tracker for the homekit integration and it was reset to not_home. so i looked in the logbook, and sure enough, about 3-4 minutes after the automation i use to set it to home if a restart happens, it jumps back to not_home. the switch is correct in both the home app and in HA. not sure what would be causing this.

1 Like

Hi, I’m pretty new to homekit
Would a non apple product like the xiaomi homekit hub works?
Because the automation tab on the home app still request for a hub

Hi all,

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…

Hi all,
I am quite new to HA and to this community (actually, it is my first post). Thanks @ptdalen and @ha_steve for this great contribtion, which did help a newbie a lot.
So I wanted to share some updates:

Configuration of HomeKit Integration
Works now completely in the UI of the HomeKit Integration. No manual update of configuration.yaml needed.

Presence Group
Still needed in configuration.yaml. As of now, no possibilities in the UI.

Binary Sensor in Device Tracker
My approach for presence detection was:

  • Device Tracker using NMAP Tracker Integration for my iPhone (because Netgear Integration not working).
  • A binary sensor, triggered by the input_boolean by the automation in HomeKit (as described above).

As a variant from above described approach, I did integrate the binary sensor into a presence group, I used ha-composite-tracker:

House Mode Adaption in the HomeKit
I do use my Composite Tracker to trigger the above mentioned input_select.house_mode. For my comfort, I show this input_select in the HomeKit. Be aware, that the name of input_select will not be shown on the iPhone automatically. You have to adapt it manually, as described here: