I know others have used HomeKit bridge to do this, but now that the native HomeKit support is in I thought I would share what I did to get MUCH better presence detection.
First, in my configuration.yaml
file, I added two input_boolean
devices which I will use as indicators whether or not my wife and I are present, like so:
input_boolean:
me_present:
name: Me
icon: mdi:account
wife_present:
name: Wife
icon: mdi:account
I also added the HomeKit
component and filtered to just those two input_boolean
devices:
homekit:
filter:
include_entities:
- input_boolean.me_present
- input_boolean.wife_present
That’s it for the configuration.yaml
editing, simply restart HA.
When HA comes back, you will have a card on the main screen that you will see a card that has the HomeKit Setup pin. Follow the setup instructions here:
Now that you have those two switches in your Home app on your iOS device, toggle the switch in iOS and make sure you see the input_boolean switches in HA flip as well. If so, you’re all set.
Add other people to your Home. In the Home app:
- Press the “nav-arrow”-looking icon in the upper left.
- Under people, you should see yourself listed, select “Invite…”
- Invite whoever else you want to be in your home. Note: You will want as many
input_boolean
s defined as the total people in your home
Ok, now that you have all people you want added, on your (the primary phone) Home app create an automation for each person that flips their input_boolean
when they leave or arrive:
- Press “automations” in the lower right, then the “+” icon in the upper right to add an automation.
- Press “When People Arrive”
- Press the “i” button a select only one person
- Press “Next”
- Select the “Switch” you want to control (which corresponds to the
input_boolean
in HA - Press “Next”
- Select the state of the switch you want when this person arrives (i.e., on).
- Then press “Done”
- Repeat 1-8 again to create an automation that turns the switch off when that person leaves.
- Repeat 1-9 for each additional person
At the end, you should have two automations per person: one to turn their switch on when they arrive, and one to turn the switch off when they leave.
Then in HA, you can use those input_boolean
s to trigger whatever you want. Also, if you put all of your input_booleans, in a group, you can use the group status for actions to do when the last person leaves or first person arrives.
So far, this has been 100 reliable for me (about a week) for two iPhones. I figured that since it’s built into iOS, they’d make it rock solid.
EDIT: I should add. In order for this to work, you need an AppleTV, iPad, or HomePod to act as your homekit hub. It doesn’t actually require any setup (other than you need to be signed in to iCloud on those devices). HomeKit will just automatically use what’s available. But you need an always-on-your-network homekit hub-capable device. In my case, I have two AppleTVs which HomeKit just auto-detected and used.