Combining physical devices into one virtual device


(Mark Stickley) #1

Hi all,

Due to a woeful lack of availability of UK garage door controllers I have hacked together a combination of a SmartThings motion sensor in Garage Door mode to check the status and a relay switch to control the momentary switch that opens and closes the door.

I’m just investigating adding custom devices (so I can hopefully correctly configure and use the relay as a push button) but I was wondering whether it might actually be possible to create a “Virtual Device” combining the two physical devices into one item within the ST app. That way the controls could read “Open” when the door is detected to be closed and vice versa. And I wouldn’t have to name my devices “Garage Door Switch” and “Garage Door Sensor”.

Is this possible or even being considered as a Thing you could do?


( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Absolutely a doable idea and not that weird, actually – though usually it’s the other way around!

You can create a Virtual Device of any set of Capabilities and/or custom Commands and Attributes. You will need to write a pretty simple SmartApp to synchronize the Attributes with the “real” devices.

One problem I’ve run into with synchronization is distinguishing sync events from “real” events; I don’t know how common the problem is, but I worked around it by adding separate “virtual” commands to the virtual device.

Let me know if you need help getting started … I just checked my files for an example, but my example is the other way around – A ThingShield project that controls my Project and Screen, so I have two Virtual Switches so I can use Alexa to control either separately if I want to.

(Mike Maxwell) #3

interesting, I started working on two things last week.
A universal garage door controller app, that functions as the glue to aggregate any number of possible garage door devices into a single garage door virtual device.

And a hybrid universal virtual device type, this bad boy responds to selectable specific device commands, then sends events for other device types.
So in one app you turn on this DTH, then another app subscribes to this devices motion capability as an example.
So this translates the switch on() method to motion active…
Here’s the current preference section for this dth…

(Larry) #4

I already did this…

(Mike Maxwell) #5

I know, this is a more universal version, supports one or more contacts, tilt sensor, or whatever the heck you’re using, optional mode operated appliance module for the door motor, creates a nice virtual device to represent the actual door.
It’s a PC app, so it can support multiple doors ect…