Most successful presence detection?

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.

  1. 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.
  2. In Hubitat, create a "Virtual Presence" device for each person
  3. Install the "Maker API" application give it a label (e.g. "Presence Detection") and turn on "Allow Access via Local IP Address"
  4. In the "Select Devices," select all virtual presence sensor you created in step 2. above
  5. In the "Local URLs" section, click the "Get all Devices" link and write down the "id" values for each device
  6. 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
7 Likes

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.

  1. 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:
    https://raw.githubusercontent.com/ogiewon/Hubitat/master/Drivers/virtual-presence-switch.src/virtual-presence-switch.groovy

  2. 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.

  1. Open ā€œHomeā€ app.
  2. ā€œAutomationā€ tab.
  3. Top right corner select ā€œAdd Automationā€
  4. Click ā€œPeople Arriveā€ (and ā€œPeople Leaveā€ for your exit automation)
  5. 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ā€.
  6. Scroll to the bottom and choose ā€œConvert to Shortcutā€.
  7. Follow the directions above.
3 Likes

I am in Android, HE app, life360, and Improved Mobile Presence aggregated with Presence Monitor, and that has been rock solid.

4 Likes

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).

See: [RELEASE] Combined Presence - #209 by SoundersDude
image

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...

2 Likes

Your method has worked flawlessly since you first helped me set it up, however it has begun to lose reliability lately. Over the last couple weeks I have found for both my wife and I we are getting missed presence events based on departure or arrival. I have been using Combined Presence with other methods so the system is OK but I still find the builtin Hubitat method to be least reliable and want Homekit working rock solid again.

Have you experienced any issues as of late with the Apple method?

I'm not who you asked, but... I've seen some glitchy false present or not present events with Apple.

I use Apple Home, Alexa, Geofency, and my iPhone as presence detectors. I have switch to using the "Presence Monitor" app to combine those because I can specify that three of the four must be triggered to change presence. So far this method has been rock solid.

The only issue Iā€™ve had at times was my wifeā€™s phone running out of battery before coming home so her arrival wouldnā€™t trigger - canā€™t really blame the system for thatā€¦

Also, all our devices are always running the latest versions of iOS (including the (wired) AppleTV 4K acting as the home hub).

Since Hubitat came out with their beta HomeKit integration, Iā€™ve changed to virtual presence sensors with switch capability so I donā€™t have to use the URL method/Maker API any longer.