[RELEASE] Combined Presence

Andy,

I am a huge fan of your programming. I extensively use your driver and apps.

+1 recommend @cobra's Virtual Presence Plus driver. It fills a cool use case: Alexa doesn't know what to do with presence sensors, but it does know what to do with switches. So make a VPP sensor and expose it to Alexa. Then use Alexa routines to do geofencing on that sensor. Converts Alexa geofencing into Hubitat presence in one step!

1 Like

It's great to have TWO such competent solutions that are really providing accurate presence sensing.

Thanks guys.

3 Likes

Let me show my work on why I settled on a simple Boolean-OR for combining inputs.

Any "boolean-like" sensor is going to have a false positive rate, a false negative rate, and characteristic times to detect changes between true/false.

In terms of our presence sensors, we have two steady states to consider: Staying away for a long time, and staying at home for a long time.

And we have two transitions to consider: Arriving, and departing, and how long it takes the sensor to detect that transition.

I characterized my geofencing (through the Alexa app and the SmartThings app) experience, and also characterized WiFi detection of my phone. Here are my results:

Next, I had to decide what events I wanted to trigger on. This will vary for everyone. For my personal case, it's important that Steady Away be accurate, and I'd like good detection of arrivals. I don't care as much about detecting departures. So I started looking at different ways to combine the multiple sensors. The two easiest would be with a Boolean-OR, or a Boolean-AND.

Bingo! If I want accuracy for Steady Away, and guaranteed detection of arrivals, then I need to use a Boolean-OR. The downside is that departures are only detected as fast as the slowest sensor.

However, if I was only interested in triggering on departures and didn't care about arrivals, I might make different choices - both in terms of sensors, and how to combine them. The WiFi has too many false negatives during Steady at Home, so I might switch it out for a SmartThings presence fob instead.

Maybe one day we'll get a sensor that's so fast and accurate that it'll "just work" for everyone. Fingers crossed!

(Edit: If I wanted faster detection of departures, I could trigger off of the departed event on JUST the geofencing sensor. It doesn't throw false negatives, so it should be fine. Basically, use the combined sensor to detect arrivals, but only the geofencing sensor to detect departures. Of course, this is more complication. So it's a tradeoff that YMMV.)

2 Likes

That is what I did. I use your combined presence with my Life360 and your WiFi presence to detect arrivals and I have a RM rule to set the combined presence to 'departed' based on a Life360 departure. Seems to work very well so far.

Thanks.

2 Likes

Another +1 for VPP!, and for the Alexa geo-fencing idea. I set that up last night, along with this: [RELEASE] iPhone WiFi Presence Sensor. I haven't tested it yet, but I'm hoping that between the two of them (and the ability to easily merge those sensors with Combined Presence), Hubitat will accurately know when nobody is home except the dog. :slight_smile:

I took out my RM rule to set the Combined Presence as 'departed' when the phone departs as I realized it already did that when both the input sensors are 'departed'. I am putting in a delay after the output sensor is set to 'departed' of one minute because I am getting that my phone left, so the combined sensor is changed to departed and I get a Pushover message, but the WiFi re-connects before it is actually out of range so the combined sensor changes back to 'arrived' and I get another Pushover message until the WiFi finally disconnects and the combined sensor changes to departed again (and I get another Pushover message).

I think I am getting this because at least one of our phones WiFi changes from ONLINE to OFFLINE very frequently and it almost always seems to happen after the combined presence is changed to 'departed' and then the phone WiFi goes to ONLINE before it is far enough ways to drop back to OFFLINE.

Oh that’s interesting. That almost sounds like your WiFi’s range is larger than your geofencing radius?

Several factor for this may be: 1) We have almost no 4G LTE signal at our house, so I have a 4G LTE network extender that then connects to our internet to connect to the carrier (Verizon). 2) We cannot isolate our network extender to just our phones so the neighbors can use it too and there are a limited number of connection available, so I have lowered the power on the network extender so we still have good coverage in the house, but not much farther.

I believe what is happening is that we get outside the network extender range and that connection drops, so Life360 is notified that we are 'departed', however our WiFi is still connected for a short time. If one of our phones switches from OFFLINE to ONLINE in that window of time we get the 'arrival', then when the WiFi finally really disconnects because we are out of range we get another 'departed'.

I am NOT a network engineer (not even close) so this is all just a guess.

What is your Geofence preference established for Home in L360? You may need to just increase it by 50 ft.

I have not tried that ... but I don't think it will help. Here is why I think that ...

We are in a 4G LTE dead zone around our house. I believe what triggers the Life360 'departed' is leaving our small Network Extender coverage area. Once we leave the Network Extender area, there is a dead zone until we get close to the nearest 4G LTE tower. Even if I extend the range in Life360, the phone app GPS will detect it, but since there is no 4G LTE signal there is no way for the app to communicate that to the Life360 servers and then to Hubitat, so Hubitat still thinks I have departed even though the Phone App may say otherwise. As you suggested I could boost the power of our 4G LTE Network Extender to broaden the range .... but that has the downside impact of providing coverage for our neighbors and potentially blocking our connection because there are a limited number of connections available in the Network Extender. If the neighbors are using the Network Extender, we may not be able to.

Again, not a network engineer and just guessing at this.

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.

How do you setup Alexa geo-fencing?

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?

1 Like

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.

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.

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:

@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:

Do you have the parent app installed?

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