Virtual Presence Question

I'm a new user of Hubitat and I'm wondering what exactly is the "Virtual Presence" device that appears on my devices list.

What sets the state (present/not present): my phone? Life360?
Present/Not Present from where? (Home, Work).

2 Likes

"Virtual" meaning it's not real.. you have to set it present/not present via a Rule because of something else. Maybe you have a Pico mounted to the wall next to the door and you routinely press a button coming and going. That button can set a virtual presence switch and then THAT can be used in places where you want a presence symbol (dashboard) or in an App that explicitly wants Presence.

I use it with my iPhones which tell HomeKit, which is seen by Homebridge and signals Hubitat to set the virtual presence switch...

Another way that users interact with virtual devices (and actual devices really) is via the Maker API. This allows other systems to issue commands directly to devices without having to go through another system or rule.

I found the answer in

Yes, once you add and configure Life360, the app will create a Presence Device automatically.

Now, if I could just find a way to manage multiple places and not only when coming/leaving from ONE place... Anyone?

You can do this with 'Locative'.

Thanks, but I found this on Locative · GitHub

Locative
[NOT MAINTAINED] This was a home automation project I did a couple of years ago. Only here for reference but not further maintained nor developed.

Is there another version somewhere else?

Although its no longer supported it works great.
Load that app on your mobile device.
Create a virtual presence device.
Then use the built in HE makerAPI to define the 'GET' in the locative app.
You will need a virtual presence sensor for each location you wish to define.

Works great for me.

This is the main Locative presence thread. This should help get you started...

1 Like

Thanks I'll check that out.

Geofency, which works basically the same way as described in the Locative thread, is another option. It’s a few bucks, unlike Locative, which is free, but Geofency is still supported. And I’ve actually found it to be a little better than Locative, which for some reason is usually good but sometimes drops arrival/departure events for me.

The specific person/s that created Locative has moved along, allowing anyone else to pick it up.

Under the heading of Hearsay: I have read that someone recompiled it and verified that the existing code still worked under the latest mobile OSs. I got the impression the writer would have attempted to fix any problems found.

And Oh By the Way... if you use iPhone, it supports multiple geofences, which I found out a week ago.

In Hubitat - can I make a virtual switch that is updated from ifttt and use that switch to change presence in hubitat?

i.e i use google wifi on off ifttt trigger to turn on switch in smartthings right now. WHich i have a webcore rule setup that sets presence to home away etc...

thank you

You can actually do two in one. With the following driver, turning the switch on makes it Present and Off makes it not-present.

/*
 * Virtual Presence with Switch and delay
 *
 * 
 *
 *   
 * 
 */

metadata {
    definition (name: "Virtual Presence with Switch + Dealy", namespace: "ryancasler", author: "Ryan Casler") {
        capability "Sensor"
        capability "Presence Sensor"
        capability "Switch"
		

    }   
}

preferences {
    section() {
        input name: "departDelay", type: "bool", title: "Enable Delay for Departed", defaultValue: false
		input name: "delayDeparted", type: "integer", title: "Number of mins for departed delay.", defaultValue: "0"
		input name: "arriveDelay", type: "bool", title: "Enable Delay for Arrival", defaultValue: false
		input name: "delayArrival", type: "number", title: "Number of minutes to delay arrival", defaultValue: "0"
	}
}

def arrived() {
	sendEvent(name: "presence", value: "present")
}

def departed() {
	sendEvent(name: "presence", value: "not present")
}

def on() {
	unschedule()
	sendEvent(name: "switch", value: "on")
	if (arriveDelay){
		def delay=(delayArrival.toInteger())*60
		runIn (delay, arrived)
	}
	else{
		sendEvent(name: "presence", value: "present")
	}
}

def off() {
	unschedule()
    sendEvent(name: "switch", value: "off")
	if (departDelay){
		def delay=(delayDeparted.toInteger())*60
		runIn (delay, departed)
	}
	else{
			sendEvent(name: "presence", value: "not present")
	}
}

def installed() {
}
2 Likes

awesome thank you - is that app code youve posted like a smartapp in smartthings?

No, a driver, like a DTH in smartthings.

awesome ok.

right now i'm using this guys lovely app that creates end points to update via a url command

It seems like i should be able to trigger this switch in a similar way via a curl command?

> /**
>  *  Camera Motion
>  *
>  *  Copyright 2015 Kristopher Kubicki
>  *
>  */
> definition(
> name: "HTTP Motion Endpoint",
> namespace: "KristopherKubicki",
> author: "kristopher@acm.org",
> description: "Creates an HTTP motion endpoint for your camera or other device",
> category: "Convenience",
> iconUrl: "https://s3.amazonaws.com/smartapp-icons/Meta/intruder_motion-cam.png",
> iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Meta/intruder_motion-cam@2x.png")
> 
> 
> preferences {
> page(name: "selectDevices", install: false, uninstall: true, nextPage: "viewURL") {
> 	section("Allow endpoint to control this thing...") {
> 			input "motions", "capability.motionSensor", title: "Which simulated motion sensor?"
> 			label title: "Assign a name", required: false
> 			mode title: "Set for specific mode(s)", required: false
>     }
> }
> page(name: "viewURL", title: "viewURL", install: true)
> }
> 
> def installed() {
> 	log.debug "Installed with settings: ${settings}"
> }
> 
> def updated() {
> 	log.debug "Updated with settings: ${settings}"
> 	unsubscribe()
> 
> }
> 
> 
> 
> mappings {
> 
> path("/active") {
>     action: [
>         GET: "activeMotion"
>     ]
> }
> path("/inactive") {
>     action: [
>         GET: "inactiveMotion"
>     ]
> }
> }
> 
> void activeMotion() {
> 	log.debug "Updated with settings: ${settings}"
> motions?.active()
> runIn(15,"inactiveMotion")
> }
> 
> void inactiveMotion() {
> 	log.debug "Updated with settings: ${settings}"
> motions?.inactive()
> }
> 
> 
> def generateURL() {
> 	
> 	createAccessToken()
> 	
> 	["https://graph.api.smartthings.com/api/smartapps/installations/${app.id}/active", "?access_token=${state.accessToken}"]
> }
> 
> 
> def viewURL() {
> 	dynamicPage(name: "viewURL", title: "HTTP Motion Endpoint", install:!resetOauth, nextPage: resetOauth ? "viewURL" : null) {
> 			section() {
>             generateURL() 
> 				paragraph "Activate: https://graph.api.smartthings.com/api/smartapps/installations/${app.id}/active?access_token=${state.accessToken}"
>             paragraph "Deactivate: https://graph.api.smartthings.com/api/smartapps/installations/${app.id}/inactive?access_token=${state.accessToken}"
> 
> 			}
> 	}
> }

That app won't work in Hubitat. It uses smarthings cloud links.

You can use this device along with the MakerAPI. That allows for control of any device via a web-link. There is more documentation on it here:
https://docs.hubitat.com/index.php?title=Maker_API

1 Like

all good just showing an example of what i use. will check the docs out thank you! EDIT: Seem pretty straight forward.

1 Like

Most welcome. Good luck!!

Thanks to Ryan's driver I don't need this ability right now but is there a way to change a virtual presence devices state using Rule Machine? I haven't been able to find a way yet.
Thanks.