[RELEASE] Combined Presence

@jwetzel1492

using this driver

Summary
/*


*/

metadata {
    definition (
		name: "Hubitat presence Combined Driver", 
		namespace: "mark-c-uk", 
		author: "mark-c-uk",
	    importUrl:""
    ){
        capability "PresenceSensor"
        capability "Notification"
command "arrived"
            command "departed"
    }
}

preferences {
	input("loggEnable", "bool", title: "Enable logging?")
}

def installed() {
	log.trace "installed()"
}
def deviceNotification(text){
	if (loggEnable == true) log.info "${device.lable} Notification message recived $text"
	sendEvent(name:"notification", value:text)
}
def arrived(){
	if (loggEnable == true) log.info "${device.lable} arrived"
	sendEvent(name:"presence", value:"present")
}
def departed(){
	if (loggEnable == true) log.info "${device.lable} arrived"
	sendEvent(name:"presence", value:"not present")
}

and adding these
ln 141

if (outputSensor.hasCapability("Notification") == true && inputSensorsGps.hasCapability("Notification") == true){
subscribe(outputSensor, "notification", NoteHandler) //assuming custom virtal driver`
}

and this

def NoteHandler(text){
    log.info "message recived from $outputSensor ${text.value} sending to $inputSensorsGps"
    inputSensorsGps.deviceNotification(text.value)
}

you can use the app to pass though notifications so that you can then route all your notification and app's to the one virtaul presence device

Interesting. I don't use the Notification capability, I don't think. What's the use case here?

just so have one device to point all your rules and notifiactions to, at the moment i have presance rules to the virtual and notifiactions to the hubitat mobile app

I'm seeing the same behavior now. My GPS presence is 'not present' and my Wifi presence is 'not present' but my output sensor is 'present'. Standard combiner with all logging enabled. Is there any sort of a delay or should it be instantly reflected in the output sensor once both are not present?

app:2702022-03-30 09:02:19.023 am debuginputsAreInconsistent false
app:2702022-03-30 09:02:19.020 am debuginputsAreAllNotPresent true
app:2702022-03-30 09:02:19.018 am debuginputsAreAllPresent false
app:2702022-03-30 09:02:19.015 am debug***** checkForInconsistencies()

I've been trying to troubleshoot this issue with no luck.. I have a GPS device for my wife's phone (Smartthings App through HubConnect) and that device is funcitoning as expected, the states change correctly within Hubitat. I also have a iPhone Wifi Presence device for her phone and that functions correctly. However, her standard combiner stays 'present' even when both of those other devices are changing. I have the same setup for my phone (smartthings + wifi) and my standard combiner works fine.

I have tried reinstalling Combined Presence, setting up the GPS/wifi devices again, setting up a new output device, etc. Any help would be great.

I've wondered if it was a versioning thing. I haven't been experiencing any issues. This morning, I updated my hubs to latest firmware. We'll see if anything changes.

I am having what seems like the same problem as @BrenenP and @stevenkandres

I've got 2 standard combiners, 1 for me and 1 for my wife. Both are configured the same to combine an OwnTracks Virtual Mobile Presence Device with an iPhone WiFi Presence Sensor. When my 2 presence sensors are "not present", the output sensor associated with these shows "not present". However, when my wife's 2 presence sensors are "not present", the output sensor associated with these shows "present". I'm using Standard Combiner v2.2.1, installed via Hubitat Package Manager and my hub is running 2.3.1.138.

Have we found any possible solutions for this? Let me know if any further information would be helpful! I'm happy to help troubleshoot!

Unfortunately, I'm not able to reproduce it here at my house, with mine or my wife's phones.

How's big are you Geo fences? If your wifi has better range than the size of your geo fense you could have race condition.

Ah, interesting @napalmcsr. However, my Wi-Fi is actually pretty weak and my geofence radii are set to 300m, definitely beyond my coverage area.

1 Like

I remade this app in Webcore, it's working as expected now.

Sweet. Do you want to share your app? Maybe I can give it a try.

Sure!

It just follows the logic of this app, where Wifi devices can trigger arrival but not departed, and GPS devices can trigger both arrived and departed.

Unknown Device 22 and Unknown Device 2 are iPhone Wifi Presence Devices

Unknown Device 23 and Unknown Device 3 are Smartthings Presence Devices

Unknown Device 20 and Unknown Device 19 are the virtual presence devices I had made for this app to manage. It works perfectly now. I know this is sidestepping this app, but it just doesn't work for me after hours of troubleshooting.

1 Like

I have a novice question for this Combined presence app. I have used presence to arm the Hubitat HSM monitor when both my wife and I have left the house via Rule Machine. I used Life 360 and our Samsung phones for presence sensors. Recently, the HSM would arm when I left but my wife was still at home. This led to misery and anguish.

I read that the Combined Presence app could help with this issue. I used Hubitat Package Manager to install the app. I set up a a Boolean-Combiner for myself and my wife. I did not set up Standard Combiners for either one of us. I used the Life 360 presence and the Samsung phone for each of us to set up two boolean sets-one for me and one for my wife.

The problem is probably that my brain is too small to set this up correctly. Is there a resource for this app to explain how to setup the virutal sensors so that I can instruct Rule machine that the last person leaving arms the HSM and the first person arriving disarms the HSM? Thanks for your help.

This is a nice app to have, but i don't think it solves the real problem, that we do not have a reliable geofencing app. Or maybe i am wrong and someone could explain.
Let's say we have multiple geofencing apps combined. What happens if one of the apps does not wor k and it continues to show that you are in the geofence area? It does not matter that the other apps work because the logic would be something like all of them show not present. If you use the other possible scenario and set departed if any of the apps shows departed, it is the same case. It won't work.

The logic in this app is configurable so that if at least one of your geofencing solutions departs, the combined sensor can be marked as departed, even when one of the underlying sensors is “stuck” as present.

Since this thread is dedicated to discussion about one community developer’s solution to the problem of mobile presence (which in my experience isn’t limited to Hubitat), please consider asking more general questions like this in a new thread.

Or better yet, here’s a thread that was recently created and was meant to be a discussion about presence sensors in general (including mobile presence). This thread would be a great one to have a further discussion about the pros and cons of Hubitat’s built-in mobile presence solution.

1 Like

Hello,

First let me say that i am not criticizing your app. Every attempt to fix the problem is more than welcome.

Second, i have a suggestion. Could you add the possibility to choose a switch as presence trigger? I have a setup in which i use SmartThings presence trough HubConnect. I get a virtual switch triggered in hubitat. It might be useful for someone with similar setup.

Regarding the logic, the only feasible way i see is to use something like "any of these" arrives / departs, so if at least one of them works in time, the result should be ok.

No worries, this isn’t my app. I’m just trying to keep the discussion in this thread on topic (i.e. limited to this app, not mobile presence in general, or Hubitat’s built-in mobile app with geofencing capability).

I can’t tell from what you have posted so far which options for this app you have chosen to implement. A screenshot of the app as you have set it up is often helpful to understand better.

The post I linked to explains how to use what the dev calls “advanced bindings.”

That is one way to work around the issue of one presence sensor remaining stuck in the “arrived” state while others have correctly reported that you have left your geofence.

1 Like

Could you change the virtual switch to virtual presence? Or, add virtual presence sensor and add a rule to set is as "present" when the switch is on and "not present" when the switch is off.

1 Like

You can do that already with the virtual presence device you are using as the combined presence device. I have it on a "presence" dashboard as a switch. On the rare occaisions it doesn't pick up the change in presence from my HE presence, I just toggle it on or off.

Basically, I set up two "Or" combiners. They each have only one input - My HE Presence for each phone. I combined both of those into another "Or" combiner for determining if either of us are home. This works 99% of the time. Most often, when it doesn't work, it is because my compass calibration got off on my phone (usually after an update or exposure to a magnet). In those instances, I just toggle the virtual presence (as a switch) and then fix whatever problem was causing the HE presence not to report.

Presence Dashboard

Include Virtual Presence as a switch