[RELEASE] Combined Presence

community_app

#21

I had an interesting glitch the other day. My wife's Alexa app wrongly decided she had left the house one day. So then when her iPhone's wifi went to sleep, Combined Presence decided that she was actually away from the house. I myself was actually away from the house at that time, so my rules started trying to lock all the doors and shut the garage. Unfortunately, my wife and kids were playing in the garage and driveway at the time, so to them, it seemed like the house was going crazy.

So now I'm using Combined Presence with 3 input sensors for each person:

  • Alexa geofencing
  • HomeKit geofencing
  • iPhone Wifi Presence Sensor

I haven't had a problem since. The Alexa and HomeKit apps seem to use slightly different geofencing algorithms, so my home is that they won't be subject to the same error at the same time.


#22

How do you setup Alexa geo-fencing?


#23

The Alexa app on your phone lets you set up "Routines". I have a pair for "Steve's device leaves home" and "Steve's device arrives home". If you haven't created routines yet, it's pretty easy. The geo-fencing part even lets you adjust the radius of the area around your house.

The trick is what to do when leaving or arrival are detected. That's where the "Virtual Presence with switch" driver gets involved. All it does is act like a switch connected to a presence sensor. Alexa sees it as a switch, so it can turn it on when you arrive and off when you leave. Hubitat sees it as a presence sensor, so it can control modes and stuff.

Do you need help installing the device driver and setting up virtual devices, or just wondering about the Alexa side?


#24

I have Routines setup in Alexa but unfortunately, being in Canada, we don't have the option of geo-fencing yet. I just wondered if there was another way of doing it using the virtual presence.


#25

Shoot, that stinks that Canada doesn't get it yet. You can also do the same thing with HomeKit, if you have a HomeKit/Homebridge setup. And there are other geofencing apps that can do the same thing too.


#26

I don't have homekit/homebridge because I would need to get a more current ipad.:anguished: Right now I use Locative, WebCore Presence and ST Presence. Some are more reliable then others. This is what lead me to Combined Presence. :smirk:


#27

@jwetzel1492, I just tried to update your Combined Presence App on my system and I got the naming error below....

Just thought you should know. :slight_smile:


#28

Do you have the parent app installed?


#29

That was the parent I was trying to reinstall.
It was as if there was a cut and paste mistake.


#30

“Combined Presence instance” is the child app.

Edit: just looked at the GitHub repo.

I think you might be right.


#31

I’m away from my hubitat this week, but I’ll look at it as soon as I can.


#32

Ok, you guys are correct that I made a copy-paste error. I have reverted the changes to the combinedPresence.groovy file.


#33

Awesome man.
Thx


#34

I thought I would document what I did for others who like me may be noobs.

  1. I installed the "iPhone WiFi Presence Sensor" app listed above. You need to install that first and be sure it works. There are details how to install it and make a virtual device for each phone in a separate thread.

  2. Have the Hubitat App geolocation set up and running. Be sure there is a "mobile app virtual device" created for all your phones.

  3. Create multiple new virtual device > virtual presence, in the devices tab. I named one "Spock Home", a second "Sulu Home" and a third "S&S Both Home"

I then made 3 advanced combined presence rules.

  • Username "Spock" rule is: If either Wifi-Spock virtual presence or Geolocate-Spock virtual presence arrive, mark present. Also, if both depart, mark not present. Send that to virtual presence output device "Spock Home".

  • Second rule, similar to above for username "Sulu".

  • Third rule: Make arrive if "Spock Home" and "Sulu Home" all present. Also make depart if either Spock" or "Sulu" depart. I used the virtual presence for Spock" and "Sulu" as inputs, and the combined "S&S Both" virtual presence as an output.

I made a multiple dashboard tiles using the separate users, and the combined users presence. They show if one, both, or all home or away.

This has been working fantastic. Thanks to jwetzel1492 for the terrific apps.


#35

There's a huge update on Github that I wanted to document for everyone. Here are the major updates:

Notifications

  • There are two types of notifications you can turn on:
    • Send notification when the output sensor changes state.
    • Send notification if the inputs are inconsistent for a long period. (Useful for debugging or knowing if a presence sensor has gotten "stuck".)
  • Notifications can be sent out two ways:
    • To a notification device (such as the new Hubitat app w/ push notifications)
    • To a phone number via SMS

Advanced Bindings

Since the beginning, Combined Presence has used a simple Boolean-OR to combine the inputs into an output. If ANY of the inputs were present, the output would be present. If ALL of the inputs were not present, then the output would be not present.

However, depending on the reliability and false-positives/false-negatives of your input sensors, there were situations where the Boolean-OR did not produce great results.

Here's the example of my house. I use 3 sensors:

  1. A virtual presence sensor driven by HomeKit geofencing
  2. A virtual presence sensor driven by Alexa geofencing, for detecting me a few hundred feet from the house
  3. A wifi-based presence sensor, to ensure that I am detected at close range

The boolean-OR would be great if these input sensors were all perfect. But they're not.

The wifi sensor sometimes gives false negatives, due to the phone going to sleep. That's actually not a problem for a boolean-OR, as long as the geofencing sensors are accurate.

But I discovered that occasionally either the Alexa sensor or the HomeKit sensor would get "stuck". They wouldn't detect changes for a day or two. I assume it has something to do with my phone preserving battery, but I don't really know. What I do know is that if one geofencing sensor is stuck and the other isn't, there should be a way to deal with that.

That's why I created new Advanced Bindings for Combined Presence. It's a new, more powerful combiner.

Fair warning: You don't need to be able to "write" boolean logic to use the Advanced Binding, but it will help if you can "read" boolean ideas and understand their implications.

Here's a screenshot of my combiner, configured to work with the behavior of my 3 sensors:

Basically, if it thinks I'm away, and then any of the 3 inputs arrive, it decides that I have arrived.
If it thinks I'm present, and then either of the geofencing sensors departs, it decides that I have departed. So it will be ok if one of the geofencing sensors gets "stuck". It also won't falsely depart just because the wifi went to sleep. And it won't get stuck on "present" if the wifi sensor takes a while to detect that I've left.

This is just one possible configuration. If your sensors have a different combination of behaviors, you may want to configure it differently. (You can even configure it to behave exactly like the simple binding, though I don't know why you would. But the simple binding is basically a subset of the advanced binding.)

Last, I'd like to show a dashboard I created to help understand how my sensors and combiners are behaving:

You can see that me and my wife each have 3 sensors. Those are combined by Advanced Combined Presence to get an overall presence value for me, and an overall presence value for her. Then, it uses a simple boolean-OR on those to decide if anyone is home at all. The dashboard shows the cascading behavior of the combiners.

I hope you find this valuable as I have.


#36

Awesome explanation, man.
Thx.
When I'm brave enough to update my install I'll tackle it. LOL


#37

I love the ideas in this thread! I leveraged HomeKit geo, WiFi Presence, and the iOS version of the Hubitat app for geo. Then with the Combined Presence app, I have most of the presence devices I need for my wife and I, as well as our kids. Love it!


#38

@spotty, This is awesome, and I LOVE your dashboard!


#39

Thanks so much for this @jwetzel1492! Looking forward to trying this out as soon as I get home tonight.
Quick question for the community, is anyone getting good results with this using @jwetzel1492's iPhone wifi presence and HT's built in GPS geofencing capabilities?


#40

That's what I use. Works well. For arrival, I use "ANY". For departure, I use "ALL".