Is there a way to toggle a virtual presence device?

I want to use the state of a switch to set a virtual presence device present/not present.

For the life of me, I can't figure out how to manipulate the virtual presence device at all.

Is it possible?

I don't think the stock driver allows for this. @Cobra has his Virtual Presence Plus driver and @ogiewon has a Virtual Presence with Switch driver that both add a switch capability for this purpose.

Here is @Cobra driver

Here is @ogiewon driver
Hubitat/virtual-presence-switch.groovy at master · ogiewon/Hubitat · GitHub


Awesome!!! I'll check that out - thanks!

EDIT: Yup, the Cobra one worked perfectly. Thanks again!


I created a custom command in RM and use that for programmatic manipulation of presence.

Haven't made a custom RM command yet (only been on HE 3 days). I'll take a look at that this weekend, too. I'm sure I'll need to know how to do it at some point anyway.

Easy peasy.


depending on where you're trying to do it, you can also use the Maker API to change a Virtual Presence Sensor as well. I'm not doing it for presence but I am doing it for a couple motion sensors and it works very well.

Good point. I use Locative on iPhone for geofencing, calling a Maker API for virtual presence.

the code works well but toggling on the dashboard doesn't do anything, like turn it on or off. is that normal behavior?
Thx for your input

Are you using stock virtual presence, or @Cobra's virtual presence plus? If the latter, change the attribute to a switch instead of presence. Then you can toggle on and off.

Cobra's driver already has both switch and presence. The former (the stock) you can't change anything on. It's stock. So, I'm confused by what you're talking about here.

You need a virtual presence driver that supports both the switch and presence capabilities. There is one from @Cobra that does this:

Are you talking to me or @anis_ber? If me, I'm saying the same thing you are.

You said change the capability...were you talking about in the driver?

He was asking about toggling presence from the dashboard. If he is using VPP he can change the device attribute from presence to switch and then it will toggle from the dashboard.

Sorry, I would have bet dollars to donuts you said capability not attribute, that's why i was confused. My mistake.

1 Like