Alexa Virtual Switch

Hi.

First of all, apologies, as this must have been asked before and I can’t seem to find what I need. I could also be in the wrong section of the Forum.

I am looking for a virtual switch that I can detect in an Alexa a routine and I don’t seem to be getting anywhere.

All of this I’ve done mainly on the website, rather than the IOS App.

I’ve created a Device under the MyDevices section of the website and allocated it a type of Virtual Switch.
When I try and use an Alexa Routine (IOS App) I can’t find it as a trigger in the SmartHome section.

I’ve used this code to create a virtual device : https://github.com/bjpierron/SmartThings-Alexa/blob/master/devicetypes/bjpierron/simulated-alexa-switch.src/simulated-alexa-switch.groovy
I’ve published to myself - I can then assign it to the device I created earlier.
On the SmartThings IOS app it changes type and I can see it shows a contact sensor which behaves correctly as I turn the switch off and on in the app.
On Alexa I’ve removed the original device and added the modifies app.
When I try and create a routine I can now find the device as a trigger under SmartHome, however when I go to select this it the Alexa app tells me “Error. This device is not currently supported.”

I’ve read a few recipes out there and also tried this code to create a device : https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/devicetypes/michaelstruck/alexa-switch.src/alexa-switch.groovy
This didn’t create a device in Routines I could use to trigger a routine.

If I’m missing something obvious could you please point me in the correct direction or link to a discussion on here that would help me out.

I’ve had many years experience in developing, just not with SmartThings.

Regards,
Stephen

I wonder if it’s because I don’t actually have a SmartThings Hub

For Clarity - You don’t need a physical hub, just set the location in the new device.

What you do need to do is the whole disable the SmartThings Skill, log out of Alexa, Log back into Alexa and re-enable the Smart Things Skill and allow it to search for devices.

All sorted now, thanks.

2 Likes

The issue you are running into is covered in the community FAQ, so you will want to take a look at that. It gives you the exact sequence of steps that you need to do to authorize the device and explains why you need a device which is both a switch and a sensor.

But the short answer for others who might have run into this is that at the present time Alexa routines (not smartthings routines) cannot be triggered by a switch at all. Only by a sensor.

What the FAQ is going to do is show you how to create a virtual device which is both a switch and a sensor. When you turn on the switch, the sensor will look like it opened. When you close the switch the sensor will look like it closed. The sensor part of the Device can then be used to trigger an Alexa routine. :sunglasses:

It will also give you the exact sequence of steps that you need to follow in order to get that virtual device visible to Alexa routines.

(It sounds like you found the right virtual device, you just didn’t follow the full sequence for authorization the first time.)

Here’s the FAQ (the topic title is a clickable link)

Thanks JDRoberts.

You are spot when you say I wasn’t following the exact sequence.

I was fooled into thinking that changing the device type in ST, deleting it in Alexa and searching for new devices in Alexa would work. I was fooled because the trigger appears in Alexa Routines. If you don’t follow the full sequence, Alexa claims device isn’t supported.

All good and working now, just the way I wanted.

1 Like

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.