After reading many, many posts on here, I have decided to ask the question in hopes of getting a complete and simplified way to setup presence using homebridge. I have homebridge installed and I have installed the new homebridge Maker Api plugin. But I am completely not getting it when it comes to how I setup presence in homekit and link it to homebridge, etc. and have various geolocations, etc. Also, how do I have multiple presence on homekit? Can anybody help with this?
I'm going to suggest "the long way" because it packs all the fiddly stuff to the end.. you'll see it work first, then at each step after, you'll know what you broke.
Create a Virtual switch to begin with.. you'll swap out the driver later. "Jane Present" or similar. Add it to Homebridge and verify you can On Off from the iOS Home app and see the changes in Hubitat. If you get this far, you have it all working, just need to automate it and make it 'pretty'.
On the iOS Home app side.. Got an Automation added? "When People Arrive" and have that turn on "Jane Present" switch. Then add a 2nd automation, "When People Leave" and have that turn off "Jane Present" switch.
The first automation 'suggests' "anyone arrive" and "anyone leave" and that's great to start with... but I suspect you'll want to differentiate... so make another "Tom Present" and add to Homebridge, verify that it works as a switch then create new automations... however, this explanation has to take a detour.. you have to add Tom's Apple ID to your Home App. Click that Home icon on the lower left, then the home icon upper left. In the middle is Invite.. go through that process and Tom will have to accept the invite on his phone.
Then it's back into Automation to add a 2nd "When People Arrive" but this time you'll be able to pick Tom's Apple ID and tie it to "Tom Present".. duplicate for "People Leave"
Then go into your two automations and change it around to be just you, not "anyone."
You have 4 Automations, go into each and make sure they are ENABLED.
Let me know when you get this far.
What's left is to change the driver out to a 'hybrid Presence + switch" driver. Homebridge may need a restart to see the new Attribute. That will put two Home tiles for each person. I have a room I create called "Whole Home" and put the 4 tiles in there. You can make one of each pair a favorite, depending on how you use the iOS Home app.
If I had to start all over, since I do know it works, I'd start, of course, with the correct Custom driver and save a couple steps. I'd get the Significant Other's Apple ID added first, so that I could create each Automation pair right (single person) to start with.
One of many 'Hybrid' Virtual Presence drivers:
That one is easy for me to find
Thanks for helping out! I will work on this when I get home and report back. I was able to get the virtual switches recognized in homebridge but because I am not home right now I can't get them into homekit.
So far so good! I have added all of our ios phones (4 of them). Do I need to add a two virtual presence sensors for each phone? Or just one because it will detect present and not present? Also, is there a way to have multiple locations? ie: My work, Tom's work, kid's school?
What is the difference between your virtual presence hybrid and the HE virtual presence sensor?
It’s more like one virtual presence device per phone per location that you want to include. You should be able to setup whatever location you want in the automations screen of the Apple home app.
In order for this to work with HomeKit, you need a presence device that is both a presence sensor and a switch. The Apple home app is turning a switch on and off, there is no way for it to toggle a presence device. But the Hubitat driver keeps the switch and presence states in sync.
@marktheknife answered this.. the 'hybrid' virtual driver is two devices in one. We are used to that with real devices such as the Aeon Multisensor6 with 6 completely different devices within. But in the virtual driver space, they tend to be more 'pure'. I began using the 'hybrid' tag to identify (for myself especially) which driver does what. Hubitat's built in Virtual Presence Sensor driver is the 'pure' variety. Homekit will display it on the Home app as a sensor, like a door sensor.. you can not change it. It will tell you what it is (present, not present) but you can't change it from the Home app side. Homekit will toggle switches, again, as @marktheknife said. The 'hybrid' driver is both so both show up in Home app. You can have Homekit change the switch portion and that event causes the Presence portion to change to match... so Home will show the correct state.
In Hubitat, like Homekit, Presence sensors are read-only, just like a Door sensor is. (Real presence devices that is.) Rule Machine can be tied to EITHER the Presence change or the Switch change.)
In my system, I 'hide' the switch side of the hybrid presence sensor by stuffing it into Whole Home Room and using Favorite on the read-only Presence so I can see the condition with out worrying about fat fingering them.
In RuleMachine, again, I only use the Presence side because it makes the Rule a tiny bit clearer.
You do not have to mimic my use. It is NOT mandatory to use the Hybrid driver.
Using the Virtual Switch driver alone will give you ONE Home tile per phone. Using the Hybrid Virtual Presence driver gives you two Home tiles, one for the switch - which is required, and one for Presence, which is 'decorative.'
Not with HomeKit.
I suppose you could buy some more Apple TV's and sprinkle them around town, nah.. let's just go with no for now
So if I leave the location Home does the virtual switch get set as 'not present' and 'off'? If this is the case, I am not understanding why we need a switch? I wouldn't want to set the virtual presence myself, I just want it to determine when I am Home or Away.
The switch is all that you NEED.
You cannot create an Automation in HomeKit using a "Presence Device."
You can though, create an Automation in Homekit, driven by the phone's presence within the house, to a switch.
You come home, HomeKit runs the "Jane Arrives" automation and turns on "Jane Present" switch. "On" is sent across Homebridge to Hubitat where the driver sets "Jane Present" to be Present, and Homebridge passes that to HomeKit and it displays on your phone.
Simultaneously, Hubitat sees the Events of On & Present and all the Rules subscribing to either, run.
My choice is to 'care about Presence' and not care about the switch. I need the switch for HomeKit to cause Presence to change, but I don't display the switch or check it. I test/check/display Present or Not Present.
You have your own choice to make there, use the Hybrid driver and simultaneously get Presence or use a virtual Switch.
OK, this is starting to sink in. So each iPhone will need a virtual switch hybrid. Could I setup different locations in the Home app and just have different virtual switches for each location?
No. EDIT: --> YES!
Yes you can! In the Home App, when you go to Automations, you can select the location and then assign a different virtual switch action to turn on.
I think there is a limitation that you can only assign an automation to yourself that is different than home.
E.g. you could enable the Hubitat Virtual Switch "I am at work" when you arrive at your work location and then enable the Hubitat Virtual Switch "I am home" when you arrive at home. Vice versa for when you leave.
However, you cannot do the same for your partner ON YOUR phone. Your partner has to do it on their phone, except for the Home location. iOS limits what you can do with someone's location so you don't track the person.
Hope this makes sense
ok, I had never connected the dots.
Automation then + to create a new...
People Arrive, but click the i next to "anyone arrives' and pick just yourself.
Then click Location and then set a new location via address or map.
If you don't reduce the People Arrive (or Leave) then the scary message shows up and I've always clicked cancel at that point. Trim the list of people to just the phone owner, and you can add locations.
Got a check mark next to "Learned something today" -- Thanks dan.t
Thanks for the help! I thought I could do it when I saw the locations. Haven't had time today to set it up though. I am going to make a separate Maker API App for these presence sensors.
One more question, maybe.... when I add a new virtual switch into Maker API, do I need to restart Homebridge every time for it to see it or will it eventually show up? Also, if I hide it in Homebridge will it hide it from Home app?
Right now you still need to do a restart when you change something. I am working on a more dynamic load where you don't need to do that anymore but it is more involved than you might think.
No problem! Thanks!
@csteele...Just an update so far as to how this is going. It has been working great since implementing. I have setup various locations and I have rules that notify me using pushover or announce arrivals and departures using the iPhone presence and homebridge. Seems very reliable. I am using the Homebridge Maker API connection. Also, my hub hasn't locked up at all. The only hiccup was when I updated the app and I had to redo all the automations in HOME again because I had to setup the virtual switches in homebridge again. So it seems to be working now and I can't see having to update it again.
Actually there is one reason... bugs... there was a nasty bug in the plugin that didn't update temperature and humidity for multi purpose sensors. I released an update for that yesterday:
Unless you don't show temperature or humidity in Homekit at all.
That update will not mess with your automation or room assignments. That really "only" happened when I completely restructured some internal things in version 0.2.0.
Is there any chance that you can point me to some kind of simple, easy, clear, concise, complete, consistent example of a bare-minimum config.json for homebridge that implements this solution? I feel like a complete idiot because I've spent hours trying to google examples of what this file is supposed to contain, and I can't find any two that agree. I can't even find answers that agree on where this file is located or where it should be. I've even tried to install GUI plugins to help, but it always comes back to I am doing something wrong with config.json and cannot for the life of me figure out what it should contain.