What's the point of virtual sensors if you can't turn them on or off?

Coming from ST where they had a Universal Device Type that acted like a switch but could also act as any other sensor. So if you wanted say a virtual smoke detector (to integrate one that works with IFTTT but not ST), you could use logic or IFTTT to turn the virtual device on like a switch that would also turn on the smoke detector.
I see that Hubitat has virtual devices, but I can't control their states. What is the point of them if you can't control their states?
TIA.

You can easily control their states via Rule Machine, if the goal is to change them on the Hubitat side of things.

If you want to change them from Alexa or IFTTT, then there are many community written drivers that incorporate the switch capability along with either a motion or contact sensor capability.

I have three in my GitHub repo that you're welcome to use.

3 Likes

You can with lots of these drivers--most expose custom commands that let you manipulate their states. Because most of these aren't standard commands, you'll likely need a rule or custom app to do it, but it's still possible.

In your case, you may need a custom driver that exposes one capability and secretly manipulates another--like a virtual switch that manipulates the state of a virtual smoke detector using on() or off() commands from the switch. I'm not of any such drivers, but it wouldn't be too hard to write one. Someone can probably help you out if you say what you need. (Like @ogiewon as I was typing--I think I've used that virtual motion/switch driver in the past!)

Hubitat also has a built-in Virtual Omnisensor driver, but it doesn't really map standard commands to any unexpected/custom attributes--it just exposes a lot of capabilities. Probably not what you want, but throwing it out there.

3 Likes

By the way, was this the ST DTH you were using? :wink: The author is none other than Hubitat's own @mike.maxwell!

3 Likes

That's actually the exact one I was using! I actually modified his original to include smoke, water, and sound which he later included. Also made a lite version that got rid of locks/door control and some other security sensor features so that Alexa could use it. That thing was a life saver for me. Made a lot of things possible and easy to do. Really surprised there isn't something like that for Hubitat already.

If nothing else works, try using a virtual lock. A lock is a sensor device, If you manually lock or unlock a real lock, the sensor in the lock reports the status of the lock. A lock is also a switched device. If you tell the lock to unlock the actuator will unlock the lock. Thus, you can use a virtual lock as your communicator between Hubitat and your voice assistant. Set up rules in Hubitat that tell the virtual lock when to lock and unlock. Your voice assistant will be able to read the lock sensor status. If you set up routines in your voice assistant to tell virtual lock when to lock and unlock, then Hubitat can see the changes.

I ended up creating a Virtual Switch that can control/act as: Switch, Contact, Motion, Presence, Smoke, Water, Shock/Sound, Sleep, Battery, and Valve sensors/devices. Control it with On/Off to set the values for those capabilities.

1 Like