Bud

Feb 10

SmartThings Virtual Switches ~ From Creation to Application

Updated: Apr 7

Virtual switches can be extremely useful. If you are not using them as part of your smart home setup you really should. In today’s episode I will tell you everything you need to know about using SmartThings virtual switches to control actions in third-party apps. I’ll cover where to get them. How to get them setup.

The information that I am presenting today applies to the use of third-party apps like SharpTools, and connected voice assistants such as Google Home or Amazon Echo devices. To profit from this information you must one or more of those apps connected and you also must have given them permission access your SmartThings account and various devices.

Let’s begin with a simple understanding of virtual switches, A virtual switch is merely a device that you create within the SmartThings app. Because these devices are created, and are not actual physical devices, we refer to them as “Virtual”. There are only two actions that these virtual devices can perform. They can only be turned on or turned off.  So, think of the virtual switch as a light switch. They have one of two states, on or off.

To be able to create a virtual device, we must install the app that is needed to create them. We will be using the Virtual Device Creator app that was developed by SmartThings Community Developer, Todd Austin.

  • When you click on the provided link, you will be directed to sign in to your Samsung SmartThings account using the same username and password that you use for signing into your SmartThings app.

  • Once you have signed in you will see Todd Austin’s Shared Projects page.

  • To access the vEdge Creator app, you must tap the Enroll button to enroll your hub.

  • Tap on the “Available Drivers” link.

  • You will then be shown a page listing all of the available drivers.

  • Scroll down the list to find the driver titled “Virtual Devices V2” and then tap the button that says “Install”. This action will download the Creator App to your designated hub.

Once the driver is installed you can close your browser and go back to your SmartThings app.

  • Within the SmartThings app, tap on the plus sign to add a new device.

  • Tap “Add device” and then tap the button on the very bottom of your screen that reads, “Scan for nearby devices”.

  • The latest version of the vEdge Creator app will be discovered.  Just tap “Done” to install.

  • The vEdge Creator app will be installed in an “Unassigned” room. In my case if have the app located in a room titled Miscellaneous where I also keep my SmartThings and Aeotec hubs.

With the Creator app installed you are now ready to create your first virtual device.

  • Go to "Devices" tab in SmartThings app and find the tile called vEdge Creator v2.94.

  • Tap on the vEdge Creator tile

  • In the screen that follows, tap on the settings cog next to “Select & Create Virtual Devices”.

  • You will see a popup list containing many types of virtual switches.

  • The device which you need to communicate with third-party apps is the “Alexa Switch”.

  • To create the Alexa Switch just tap on it and it will be created.

When you create your “Alexa Switch” it will be given a generic name. To change the name, long press the virtual switch tile and the select “edit” from the pop-up screen. In the screen that follows you can give the device a relatable name and assign it to an appropriate room. As an example, I am using this virtual switch to mirror the actions of my Closet Door Contact Sensor in our Family Room. My Ring Alarm Door Contact sensor is identified in my SmartThings app as “FR Closet Door”, meaning “Family Room Closet Door. I will therefore have labeled our virtual sensor “vEdge Closet Door Sensor”. I am also going to long press the device a second time so I can move the device to the Family Room where the physical contact sensor is located. This is so we can view the physical and virtual switches together when testing their actions.

Note that I left the “vEdge” prefix at the beginning of the virtual device label. I highly recommend that you do this for all created virtual devices. Doing this accomplishes two purposes. First, it gives you the ability to distinguish your virtual devices from your physical devices. Second, it makes it easier to find your virtual switches when creating routines. You will discover this to be true later, when I begin to write a routine in the Alexa app.

There are two additional setting changes that must be made for all created virtual devices to make them fully functional between SmartThings and your third-party app. To make these additional settings changes,

  • Tap on your device tile and then tap the three dots in the upper right.

  • Now tap on the word “Settings” in the drop-down list.

  • In the following screen, toggle on the “Auto-revert” and “Separate Contact” options.

The separate contact option creates a second virtual contact switch that will be used within the Alexa app to trigger routine actions. The auto-revert option turns both virtual devices off following activation so that they are readied for the next event. Think of “auto-revert” as an automatic reset switch. The auto-revert option is needed in most cases but there are some use cases where you might want the virtual devices to remain on until a later time when they are turned off by another smart home device or event.

To finalize setup for the second virtual switch, you must rename it to match the label of the first virtual switch. Don’t worry that the two created switched share the same name. You will be able to easily distinguish these two devices. The first created device has an on/off icon and the second device will appear as a contact sensor. It will also have a label of “- contact” at the end of the device name label.

Please be careful to note that the first virtual device (which is the on/off switch) is to be used within your SmartThings routine. The second device (which is the contact sensor) is to be used within the Alexa app routine. It is important that you make that distinction for these devices to work properly.

Now we are ready to use these created virtual devices in SmartThings and Alexa routines. We will begin with the SmartThings routine.

  • Let’s begin in the SmartThings app by tapping on the first on/off virtual switch we just created.

  • Now tap on the word “Routines” at the bottom center of your screen.

  • Next, tap on the “+” at the top right of your screen.

The SmartThings app had placed your virtual device in both the If and Then sections of your draft routine. We need under the “Then” section only, so we need to remove from the IF section by tapping on the red minus sign.

  • Now tap on the green plus sign under “IF” to add the trigger device.

  • Next, tap on “Device Status”. In my example I will find and tap on and select the device named “FR Closet Door”. The device I am selecting is the Ring Alarm Contact Sensor that is normally installed on the closet door in our Family Room.

  • Next, we will select the type of sensor we wish to use in this routine. We want to use this device as a contact sensor so that we can ascertain the state of the door, whether it is open of closed. 

  • Next, we will select “Open” and then tap on “Done” twice.

Now our “IF” condition declares “If the Closet Door contact sensor is Open”. This signifies that we want to use the open state of the Closet Door sensor to trigger the action which will follow. We now need to add the action under the “THEN” section.

Our action will be to turn the “vEdge Closet Door Sensor” to the “ON” state anytime the door sensor is open.

  • Tap on the phrase: “Choose what you want the device to do”.

  • Then Select “Turn on.

  • Finally, tap “Done” twice and then Save your routine.

To finalize this virtual automation, we must create a routine within the Alexa app using the state of the “vEdge Closet Door Sensor”. The virtual switch will be used as a trigger within an Alexa routine to make a custom announcement on all of our Echo devices. To create the Alexa routine, open your Alexa app and Tap on the word “More” in the lower right.

  • Select “Routines”, Tap the “+” at the top right. Under “When”, tap on “Add an event”.

  • Tap on “Smart Home” to search the list for your virtual switch, “vEdge Closet Door Sensor”.

  • Select the “vEdge Closet Door Sensor” that displays the word “-contact” on the end of the device label.

  • Now tap “OPEN” to instruct the routine to perform the action “When vEdge Contact Sensor” is opened.

  • Tap “Next” to add the Action.

  • In the section titled “Alexa Will”, tap on “Add an action”.

  • Tap on “Announcement” and enter the phrase that you want your Echo devices to say.

  • Tap “Next” and choose the devices on which you want the announcement to broadcast.

  • Tap “Next” then tap “Next” again to confirm. Finally.

  • Tap “Save”.

Now to test your routine, just open your contact sensor. If all went well you should hear and announcement on your selected Echo devices.

Virtual switches can be used in Alexa routine as an action rather than a trigger. They these actions can be prompted by an Echo voice command and the virtual switch can then be used in a SmartThings routine to trigger a scene that controls multiple SmartThings devices. As a use case example, I have virtual switches that control the security modes within SmartThings. The three modes are Arm Home, Arm Away and Disarm. I can use my voice to trigger an Alexa routine so when I tell any Echo device to “Arm my Home” the routines will change my Arm Away virtual switch from OFF to ON. This action will cause my SmartThings Home Monitor to change the security mode to Arm Away. This change will also be mirrored on my Ring Alarm Keypad. 

I hope this episode has enlightened you on the topic of virtual switches. If you found it helpful, a thumbs-up would really make my day and provide support for my channel. Until our next smart home adventure, stay smart, stay connected!

    1