FAQ: Creating a virtual Device

“Momentary button tile” under M.

1 Like

Yes, as usual I looked under simulated switches, not where it was. Thanks.

1 Like

Just getting into simulated devices. I’ve created a simulated button, but now how do I press/activate that button from the iOS app? Or do I have my thinking wrong and you can’t ‘press’ anything on iOS to simulate the button press?

It will show up in your things list, and you just press it there like any other on/off switch.

Yup, got that. I created a piston to dim a light when pressed, but the button appears to be grayed out and when pressed, nothing happened/(s).

In that case, post your question and a screenshot of your piston in the core peer Assistance thread and someone will be able to help you there. You can just add your question to the end of that thread.

Can anyone instruct me on how to sync values from a physical multi attribute device to a virtual device.

  1. iris smart Button, has temperature sensor. I want a virtual device standalone from the Button that is simply a virtual temp sensor

  2. gocontrol window/door sensor. A community DTH allows for use of internal and external contact. And as well, assignable attributes to the contact (i.e. Fire, motion, garage door, etc) to trigger the open/close with a hardware hack.
    I simply want to sync a virtual device to the secondary contact (that only shows status on device tile page) to a virtual door/window contact.


A. Start by finding applicable Virtual Device Type Handlers (from the Templates, or from the SmartThings GitHub (https://github.com/SmartThingsCommunity/SmartThingsPublic) or from a Community post; for Temperature and Contact Sensor.

B. Make sure each vDTH has added Commands to set the desired Attribute values (temperature, contact); since normally Attributes are set by the physical device and are not exposed to “external setters”.

C. Create two very simple SmartApps (or use CoRE) that subscribes() to the “real” devices, and issues the attribute update Commands to the Virtual Devices.


aaha. Now how do I write that? :stuck_out_tongue:
never coded anything! I’ve modded a couple variables, but writing a smartapp, oh boy

Honestly, your use case of “call Command to set Attribute on Virtual Device when Triggered by Physical Device Event” is 80% similar to the “Writing your first SmartApp” example in the Developer Docs!

So, while you may find an “exact match” for Virtual Device synchronization, if you have a bit of time to spare, working through the Docs tutorial won’t steer you wrong… it will put you on the right path.


I’ll at least give it a try! Hopefully I’ll learn something and maybe get it right at the same time. Thanks!

1 Like

Hi, looking for some ideas, here’s the situation:

  1. i have 2 real switches controlling 2 sets of living room lights.
  2. i want to turn them on 100%, off, or set to “tv mode” where they are dimmed differently (one at 20% other at 40%. I want to do it with Alexa commands.
  3. I’ve been pretty successful with my first foray into virtual switches. I created one virtual switch for turning both real living room lights on together; one virtual switch for each zone individually; and one virtual switch to set the 2 real switches to the tv watching dimmer scene.

Works pretty well and Alexa handles it, but for a catch:. Suppose i tell Alexa to “Turn Living Room Lights Off”. Virtual group switch turns lights off. Then I say “Turn on TV Lighting”, virtual scene switch turns lights to proper settings. Now if i ask Alexa to turn Living Room Lights Off after I’m done watching for the night, the on/off virtual switch is in the Off position already and won’t activate. I could have the switch reset to on after activating the scene, but then if i want to go from dimmed scene to full on but saying Living Room Lights On, same problem, virtual switch is already in that position. I tried a virtual momentary bottom, but Alexa didn’t recognize it as a device. Is there a way to reset a virtual switch to neither on nor off or so that it can respond to an on command even if it’s already in the on state (and vice versa)? Sorry for the long explanation, any ideas much appreciated.

Trend Setter is the App for you. It creates the Virtual Switch and keeps it in sync with the Phyiscal Switches. You can use it as a Switch in CoRE as well.

If any of the switches are on at any percentage, Trend Setter will still allow you to sync the on/off function appropriately.

Awesome, I’ll give this a try thanks. So you’re saying these virtual devices will resond to an on/off command and activate pistons even if they are already in that respective state? Or do I need to use a virtual dimmer so that even if it’s “On”, it will still set level to 100% from a dimmed state? (and to 0% from and dimmed state)?

With Trend Setter, even if one switch is off, the Virtual Switch will be on. So, it says stuff like, “Mostly On”; “66.6% On”, “Half On”…

If I had 4 lights grouped in Trend Setter and I only had 1 light on, It would say “25%” on. So Cool. This way if you use the Virtual Switch and no matter what combination your lights are in, If you say turn Virtual Switch On, all lights come on. If you say turn Virtual Switch Off, then all light go Off.

Then using “CoRE” you set your rules for your differently lighting scenes or whatever App you have already been using.

I tried making a Simulated switch and it worked flawlessly on ActIonTiles, but when tried to make a Simulated Button, although I could approve authorization, it wouldn’t appear under “things”.
What could be causing this?

You want a “Simulated Momentary Button”, not a “Button Controller”.

Gimme a link to the DTH source code you are using, perhaps I can check.

But just have to be sure it supports the standard:

Hi again. Didn’t found the “Simulated Momentary Button” but just the “Momentary Capability”. However, it wouldn’t appear for authorization.

How about trying the “Momentary Button Tile” device handler?


That did it. Thanks!