I use @joelwetzel 's Wifi presence sensor driver with his combined presence senor app and a smart things presence fob on my keychain. This has been pretty reliable for me. When home, even if my phone drops off wifi, nothing will be triggered since my keys are in the house but both must be present to trigger lets say the door lock when I arrive home. Or both must be gone to trigger the door lock to lock
Does this require an Apple TV or iPad as a hub?
Nope. Just set up a Siri Shortcut that sends a GET command to a custom Maker API Endpoint. Super lightweight
I know this has been awhile since you posted but I am new to Hubitat and currently it (along with my old nemesis SmartThings that I just left) are doing horrible reporting with their native apps. We too are entirely iPhone based and I would love to do what you are doing. Do you have any advice/reading/guides for setting up what you are doing? Thanks in advance.
- You need something to act as a hub at home. Apple TV, HomePod, or always-on iPad work. Also, your Hubitat hub needs to have a static IP on the local network.
- In Hubitat, create a "Virtual Presence" device for each person
- Install the "Maker API" application give it a label (e.g. "Presence Detection") and turn on "Allow Access via Local IP Address"
- In the "Select Devices," select all virtual presence sensor you created in step 2. above
- In the "Local URLs" section, click the "Get all Devices" link and write down the "id" values for each device
- In the Shortcuts app on iOS, select the "Automations" tab and for each device, create two automations:
a. When "Person A Leaves Home" -> URL ("http://HubIP/apps/api/xxx/devices/yyy/departed?access_token=zzz") -> Get contents of URL (where xxx, yyy, and zzz are the values listed on the Maker API page on your hub)
b. When "Person A Arrives Home" -> URL (as above, replacing "departed" with "arrived") -> Get contents of URL
Thanks so much. That was super easy and I never would have figured that out on my own. I really appreciate the assistance.
So this was my first time using Shortcuts so I’m looking to confirm if I’m doing it right as it didn’t perform the way I expected. When I left home this morning it didn’t automatically trigger the presence but gave me a notification that I had to click on (when I arrived at my destination) to actually activate it. Is there something I did wrong that the URL doesn’t automatically process or is this how it’s supposed to work?
I’m hoping it can be completely automatic as there’s about a .1% chance my wife will EVER activate the link when she comes and goes.
The Shortcut looks correct. If I remember correctly, that notification shows up the first time only and things are fully automatic in the background after it has been allowed the first time.
2 alternatives to Shortcuts.
Use Homebridge with a virtual combo switch/presence sensor. You need to set up an automation in Apple Home using similar logic as for Shortcuts. The benefit is that a switch and automation lives in the Apple Home system while Shortcuts live on an iOS device. The combo presence/switch driver is here:
Use Geofency instead or in addition to native Apple presence
[RELEASE] Geofency Presence
Hmmm my wife came and went numerous times today and the Shortcut notification came up for her with a run button every single time. So she ran it every time she came or left. I have no idea what to do. I can’t find any sort of setting asking for a permission to run automatically. I guess I’ll need to examine some of the other options perhaps.
I have another screenshot where I expanded one more section. As well under “Shortcuts” in the iPhone settings app and then ”Advanced” I have included my current settings. Do I need to change any of these by chance?
I’m the Settings app, before the screen you showed, there is a Location setting. Mine is at “Allow while using the app”
Looking at Enable or disable a personal automation in Shortcuts on iPhone or iPad - Apple Support it says that you can’t automatically run a arriving/leaving application. However, I clearly do it. It is possible that you need to create the automation from the Home app instead. Once you get to the action part, at the very bottom under “Advanced” choose “Convert to Shortcut” and then create the same two-step automation you created before.
I tried the "Convert to Shortcut" method in Home app. I then went for a drive around the block as a test and it appears to have worked for both my departure and arrival. Thanks for all of your help. I think you've got my automations to a good place.
I'm trying to do the same as @chicoquente. I noticed when I switched from the Shortcuts app to the Home app, per @aamann's suggestion, I could no longer trigger an action off of "When I leave" or "When I arrive". Instead, the only option was "When Anyone Leaves/Departs Home". Since I'm setting up this automation for each member of the family (each with their own virtual presence sensor via Maker API), how will this work? How does Home map "anyone" to the specific device for geofencing? TIA....
You missed a step where you set the people up.
- Open “Home” app.
- “Automation” tab.
- Top right corner select “Add Automation”
- Click “People Arrive” (and “People Leave” for your exit automation)
- Click the “i” beside “Anyone Arrives” and select just 1 person (do this over and over for each person you create an automation for). Hit “Next”.
- Scroll to the bottom and choose “Convert to Shortcut”.
- Follow the directions above.
My birds look at me like... "yeah... and...?"
For me, redundancy has been key. In particular using a GEO fence solution plus local wifi.
For geofencing HomeKit has been the most reliable for me (I'm running an rPi with Homebridge on it).
I'm just going to throw my two cents in here because I have had a rock-solid presence detection for years now, with no extra apps, all within Hubitat. There could be an easier way to do it now, I'm not sure with new things being added to Hubitat and new apps all the time, but I can't see changing something that has worked better than any application I have ever tried. I have tried Life360, Blue Iris implementation with their geofence, Tasker, etc. and somebody said that if one fails, they all do and that was accurate in my point.
I have two "virtual" WiFi Presence Sensors (one for me and one for my wife) that use a neat driver code from author Joel Wetzel (iPhone WiFi Presence Sensor). It has been some time but, if I recall, this driver searches for an IP Address every so often and and updates the presence sensors as needed. Of course, we have a very solid home network so this works for us and if our phones are off our network then we are not home and vice versa.
Of course, I have other triggers to make sure if there are hiccups here and there with this device/driver (maybe it will falsely say a phone is now on network or out of network after a restart or something); such as, I am a developer so I have a house panel next to the door we leave out most often where she or I click a leaving switch, which turns on outside lights, unlocks doors, opens garage door and shutting the garage door means that person has left and the garage opening and a person's phone being found on WiFi within the same minute means that person is home (if their presence has been gone). All done within Hubitat.
What I found is really nice with this is there are bugs in our phones sometimes and recently we have found that if our phone restarts, it connects to WiFi but has no internet. With this process, it checks the local network so it still finds our phone on the network and behaves as it should. I also pause rules with other rules as necessary to make sure there is no phantom such and such "is home" or "is away" stuff. Absolutely no hiccups unless the wife takes her phone off WiFi for some reason during the day while out of the house and forgets to turn it back on by the time she gets home.
Thank you for this. I was able to implement a version of this on Android with Llama and Automate. I am a die-hard Llama user, and just couldn't be bothered to recreate its very reliable cell polling feature in Automate. So, I just used Llama to create a Toast message when my phone leaves or enters an "area". This Toast message is one that Automate detects, then submits the HTTP request to toggle the virtual presence.
I had to use the cloud URL for the "departed home" scenario because I wouldn't be able to access it without VPN, and the local URL when "arrived home". Should I be concerned about any security issues because I exposed the cloud URL via Maker API?
Late to the party, but since this thread popped up, for others prerusing it...this has been perfect for me. Set it and forget it...