Virtual Device Ideas Thread

I would like to get some ideas on how the community is using Virtual Devices with ST and any third-party devices (Sonos, Alexa, G Home) or why you use them with officially supported devices.

Hopefully this will help other think of uses they wouldn’t have figured out without this community.

1 Like

I use them quite a bit. In no particular order:

What is a virtual device?

First, for those who stumble on this thread and have no idea what we’re talking about, smartthings allows you to create a “virtual” Device of several different kinds. This doesn’t exist in the real world, but smart things will treat it exactly like a similar physical device. So you can turn it on and off, or if it’s a sensor you could have it report. It’s even available to third-party systems like IFTTT, echo, google home, etc. So that leads to a lot of different interesting applications. :sunglasses:

Here’s the FAQ on creating a virtual device

Some ways I use them

  1. to enable Alexa/Google Home Voice control of something which is otherwise not available by voice. A routine to lock or unlock. Changing mode. Changing smart home monitor armed status.
  1. I used to use a ton of these with harmony, but they are no longer really needed since the official integrations (both harmony/smartthings and Harmony/echo) have added a lot more features.

  2. to enable IFTTT Control of something which is otherwise not available through the SmartThings channel. For example, I could have an email to IFTTT run a smart things routine by tying that routine to a virtual switch. Or I could use a virtual switch in the smartthings channel/service as the “IF” in the applet and use a Hue scene or other Hue action as the “that.” This is a quick and easy way to make a Hue light blink, for example. Or get color controls.

  3. as a virtual timer. This is what lets me turn a light on for 15 minutes and have a turn itself off again, or delay the start of something in a sequence, while still being able to use the physical device in other ways at other times.

http://thingsthataresmart.wiki/index.php?title=How_to_create_a_virtual_timer_for_a_light

  1. to group lights. For example, I can have a virtual switch called “downstairs,” have a bunch of lights follow that, and now I can turn that group of lights on and off together. Of course I Could also group them in echo, but then they’re only good for voice control. By using a virtual master, I can also control them as a group through other methods, like a minimote button or routines.

http://thingsthataresmart.wiki/index.php?title=How_to_Group_Lights_Together

  1. to group sensors into a zone. For this I would use Mike Maxwell’s excellent zone manager smart app.
  1. to have one device report as a different type, again using Mike Maxwell’s code, this time the universal device type. This is one of those where you probably won’t think of a reason to use it until you run into a situation where it’s pretty much the only way to solve a particular problem. :sunglasses:
  1. to create manageable end points for multi endpoint devices. For example, if you have one of the controllable power strips that has multiple outlets, you would typically use a virtual device to represent each one of those outlets so you can turn them on and off individually.

Eric M has an excellent smartapp for using these:

  1. some people use them to represent the status of a system which is not directly connected to SmartThings. This would most commonly be a security system, but it really could be anything from a sprinkler to a medical monitoring system.

  2. virtual presence sensors. You need a presence sensor which has capability.switch and then you can turn it on and off, either manually or through IFTTT. I use these to make I beacons look like arrival sensors. Some people have one that they just flip manually when they have guests. :sunglasses::busts_in_silhouette::busts_in_silhouette:

I use Austin Pritchett’s, which is very good. There Are also a couple of other available with slightly different features.

  1. as steps in a daisy chain. If you want to try to force sequencing (normally very difficult in a mesh system), You can use virtual switches as connectors so that one device or routine starting flips on the virtual switch and another device/routine comes on because the virtual switch came on and turns that virtual switch off, and then a third device/routine responds to the virtual switch going off, etc. We used to use these a lot about a year and a half ago. They are not needed now as much because core provides a more elegant alternative for forced sequencing use cases. But it could still be useful in some situations.

While this is similar to the virtual timer, it’s set up somewhat differently because typically in this kind of daisychain you have something that subscribes to the on and something that subscribes to the off.

If you use Core, you probably won’t need as many virtual switches

For many of the above, Core (created by @ady624) now provides a good alternative. Because it allows you to create a rule (called a piston in core) with delays, sequencing, multiple dependencies, etc. it significantly reduces the need for virtual switches to simply act as stored values.

But I still like virtual devices for some of the use cases listed above, particularly as an actionable representation in a grouping use case or with a third-party like echo or IFTTT.

All of which is engineer speak for saying that if you’re just using a virtual switch invisibly to make your logic work, Core might be a better choice. But if it’s a way of representing the status of something that is otherwise not available through SmartThings, it can still be valuable. :sunglasses:

I’m sure there are a number of other uses as well, this is a very powerful feature. But these are the ones that I have actually used myself.

p.s. Ask an engineer a “How can you use…” question, you get an answer like this one. :stuck_out_tongue_winking_eye:

6 Likes

I created a virtual switch and that I call couch potato. It turns my TV on the history channel, activates a lifx scene with my living room lights and turns the lightify strip on the back of my tv a dark red at 30% brightness.

I just "Alexa, turn on couch potato. "

All done with CoRE of course @ady624.

2 Likes

How does the virtual turn on the channel? Are you using a harmony Smart Hub?

Are you using IFTTT for non-supposed things?

[quote=“JDRoberts, post:2, topic:69598, full:true”]

Here’s the FAQ on creating a virtual device

Are you sure this is still accurate?
I tried it and got the following error

Access Denied
We’re sorry, but you are not authorized to perform the requested operation.

I just tried it, It worked fine for me. Could be a shard problem, see post 46 and 47 in that thread

Another thing to learn. lol. I am on the right shard. anyway it let me create it. I do think Label is required as that was the difference between my attempts.

1 Like

Yes I am using using my harmony hub which has been linked to smarttings.

1 Like

How to make virtual switch in sync with other physical switch. for example i created “living room” virtual switch with OFF state and assigned all the lights into it. If my family member turn ON ALL the lights in the living room by physical switch, i need virtual switch “living room” to sync with the state “ON”.

You can do it with CoRE

I am trying to improve the automation of my garage door. I have spotty cell signal near the house so cellphone presence sometime is slow to activate and open my garage door. My thought is to create a second location with a geofence defined to cover the entrance to my neighborhood that would trigger earlier. Problem is, there is no way to have a device in one location activate an app in another. So my idea would be to use a virtual device that I would install in both my home and “neighborhood” locations that would keep track of comings and goings in both locations. Would this even work? I don’t know if a device handler’s state variables would be available across the locations. I know I can have the same presence sensor (my cell phone) added in both locations simultaneously and ST doesn’t treat those as two different devices (I don’t THINK!) …

Hi JD,

I need help with use case 8.

So I have a device handler, which has four relays and four buttons.

But how do I map virtual switches to the individual relays? I can only seem to be able to link the virtual switch to the whole device, not the individual relays.

Thanks

What’s the specific brand and model of the physical device?

Hi,
So the device is MCO Home touch panel switch.
I’m using a device handler built from the code by morfsta in this thread.
So I can control the four loads connected to the buttons from within the device page.
But I cannot use routines or any other automation to control the individual lights attached to the touch panel.

Thanks
Get Outlook for iOS

I don’t see a link to that code in this particular thread, unless I missed it. Your best bet is to ask in the author’s thread for the device type handler that you are using. It may need to be slightly modified to fill-in the button fields that core and other smartapps are expecting now. Those have changed over time, so not all authors have updated their code yet.

Otherwise, ask in the other thread for the virtual/physical switch synch app I linked to in point 8 in my post, and someone there can probably help you.

I use virtual devices for creating switches with multiple things.

For example: I have two lights over my kitchen sink. I rent the house I live in so I don’t want to mess with the wiring and install an actual ST capable outlet or adapter. So, I use ST compatible bulbs, specifically Cree’s.

They are named Kitchen Sink Left and Kitchen Sink Right. Normally, I’d have to tap both switches in the ST app or ask Alexa to turn on one, then turn on the other.

But now, I’ve created a virtual switch called Kitchen Sink Lights. Now, I just have to ask Alexa to turn Kitchen Sink Lights on and they both go on together.

So much easier.

2 Likes

I have one called “Annunciator” - it’s one of the Conditions in using an Aeon Door bell to announce the state of my perimeter doors.

–> If Annunciator is on AND Front Door Sensor is Open, Say " Front Door is Open"
–> If Annunciator is on AND Patio Door Sensor is Open, Say " Patio Door is Open"

Each door sensor has it’s own Core piston and thus “Annunciator” allows me to turn on/off the whole voice announcement thing.

1 Like

I have a series of virtual switches that turn on and off when above or below certain light levels.
I use these for light Automation and means I only have to change the switch definition instead of going into lots of WebCoRE pistons to alter them should I need to.

1 Like

I’m trying to use a simulated device ‘backwards’. I’ve already managed this via Tasker for another purpose, but here’s what I want to do: create a “simulated frontdoor lock” such that

A) If the front door sensor says the door is closed
and
B) the front door lock reports as ‘locked’,

Then have “simulated frontdoor lock” report as Locked.
If the above conditions are not met, then report as Open.

In other words, the simulated device won’t control anything. It will use the two conditions to make one reportable condition, that I can view remotely or ask Alexa to report. As all the devices in this endeavor are native to ST, I’m looking to do this entirely in ST rather than rely on Tasker.

The standard automation routines don’t seem to allow for multiple devices this way.
Suggestions welcome.

This should be very easy to do in web core, and quite difficult to do in anything else except maybe SmartRules ( which is a paid third-party app for iOS only).

Are you using Webcore now?

If for some reason you don’t want to use web core, do you have an iOS device?

If not, then tasker may be your best bet if you don’t want to use web core.

1 Like