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.