Presence Governor


Also, if you are trying to get the device type after the fact, you can try the following (it worked for me in ST but haven't tried in HE):

Assuming your input is called "myMobile"
def state.typeOfDevice = myMobile.typeName


Not exactly no. I'm really hoping to achieve this with the same input as all other virtual presence devices.
What I REALLY need is the ability to get the type from a device, is that what you're recommending here?

def state.typeOfDevice = myMobile.typeName

That's what you appear to be saying, so I'm going to try it. That would be far less hacky than what I've implemented.


Yup, that was the ticket. Thanks @stephack!
Get the latest 1.2.3 version, and it solves the exception @mluck reported, when using the HE Mobile App for Geofencing.


Just re-imported (assuming it's only the child that changed). Will test.
Thanks to @doug and @stephack


Bad news, @Doug. When I tested, my proxy sensor changes to "not present" on threshold geo-departure, regardless of whether the wifi presence sensor shows as present. As I understand it, a "present" wifi sensor should override departed geo presence sensors. Thoughts? I'm happy to continue being the guinea pig :grin: cuz I love what you're trying to do.


Thanks for the feedback. Try the latest 1.2.4


It works, woohoo! Thanks.



Have to say I’m loving this app!

I’m using Life360 and webCoRE presence via ST to achieve a solid presence. I currently receive 3 notifications (for each method) when me or the Mrs leaves, whilst testing. It’s not failed as yet and in most cases I get the governor message first which is great!!

Many thanks for a great app :+1:
I’ll be disabling the other two messages now :wink:


@Doug I'm getting some unintended behavior. My geo sensors are both firing "away" so darn quickly that the wifi sensor is still connected. Ergo, there's never any departure. Oops.

I could expand the geofence, which'd be a simple solution, but I'd like to avoid doing that for other reasons. I noticed your app has a Departure Delay parameter. How does that behave?


@mluck The departure delay happens after the Governor determines you're away. So that wouldn't help this situation since it doesn't consider you away with the WiFi driver still reporting present.

I've added the threshold check back in, when the WiFi goes offline. Now that I'm forcing all the geo sensors present when the WiFi is online, I think it'll be safe. Unless of course all you're using is the HE Mobile App (Since I can't force it present with missed events)

Pull the version I just pushed and test it for me, please.


FWIW, "HubConnect Presence Sensors" also cannot be forced present (they have no arrived() command).

Might be better to verify that the target device has the desired command before trying to force it:

def wifiPresenceChangedHandler(evt) {
	sendEvent(name:"Presence Changed", value: "$evt.device - $evt.value", displayed:false, isStateChange: false)
		case "not present":
			ifDebug("WiFi Offline")
		case "present":
			ifDebug("WiFi Online, skip threshold check, mark all other device arrived")
			/* 	WiFi sensor present is the ultimate truth 			*/
			 	if (it.typeName == "Mobile App Device"){
					ifDebug("HE Mobile App, skipping forced arrival on ${}")
				} else if (!it.hasCommand('arrived')) {
					ifDebug("${} doesn't support forced arrival, skipping (${it.typeName})")
				} else {
					ifDebug("Forced arrival on ${} (${it.typeName})")


Excellent! hasCommand has been implemented, that's much better. Thanks for the advice.


@doug, Overall I really like this and it's nice and easy/clear to configure, so thanks! :slightly_smiling_face:. But I am curious how you use this with the WiFi presence combined with other presence sensors. For me, WiFi takes longer to detect departure but also seems to indicate not present incorrectly due to the phone sleeping. So if I use a departure threshold of 2 things work but are slow to mark me as away compared to using a threshold of 1 but just ignoring departure of the WiFi... I'm assuming you're using 2 (or more) and just letting the WiFi take longer? If so, how would you feel about a toggle allowing the app to ignore WiFi for not present?


I use two geofences with a threshold of 2 for departure and 1 for arrival.
I have a ST presence sensor fob and the WiFi driver, in addition.

You're correct, by design the iPhone sleeps the WiFi, so when the WiFi goes offline, the Governor will check your threshold selection when that occurs which prevents the WiFi setting not present by itself. I haven't noticed a big delay in WiFi detection. However, for me, the idea behind the Governor was largely to prevent false not presents more than anything. I probably tolerate the delay to the away routines for that reason. I am down the street a bit when it kicks in. Arrival is instant as it should be.

The WiFi sensor is not required. Perhaps your use case would be better eliminating it?


Got it, thanks for for outlining your usage. I'll try it a bit with departure = 2 and wifi and see how things go. Thanks for the app!