[RELEASE] Alexa Virtual Device Creator (Formally Alexa Virtual Switch) Creator


(Micheal ) #21

Hmm…not sure. The name changed to the app, so I am wondering if that is the case as I simply copied the source to that old repository.

Try just copying this code: https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/smartapps/michaelstruck/alexa-virtual-switch-creator.src/alexa-virtual-switch-creator.groovy

and pasting it in your old code in the IDE.

(Sean) #22

I was doing a new install, however, I did just copy that code and past it into the IED under new smart app from code and it worked!

I think that just may be the issue because the file name is still the “virtrual-switch-creator” not the new “virtual-device-creator”

Thank you!


Is there some sort of walkthrough somewhere for how to create these audio alerts with the motion sensor?

(Micheal ) #24

I think there may be something on Amazon’s site, but it is rather simple:

  1. Create a virtual motion detector. Add it to the SmartThings/Amazon app and discover it
  2. Using SmartThings, but some automation around it (triggers, maybe in WebCore) to have it activate during certain conditions. Be sure to have it ‘reset’ somehow on its own since it is a virtual device.
  3. Go to your Amazon app and create a routine that is triggered with the motion sensor
  4. Have one of the results of the trigger to activate a voice from your speaker

Let me know if that helps.


Sorry for asking this here, as I know it’s a bit offtopic. However…

I got around to setting up some alerts and it seems that my Alexa must be sleeping and misses the first audio alert. Is that an issue that others have seen?

Is there a thread about these routines somewhere that i’ve missed?

(Micheal ) #26

Not sure what you mean…I have never seen what you describe, but admittedly I am not 100% sure I understand if I am understanding. I have a virtual motion sensor set up, that when tripped, sets off an Alexa notification. Works every time. Can you explain exactly the components you are setting up and the expected results and the actual results?


Actually, it looks like my routine isn’t working at all. I set up a simulated contact sensor. When I open/close it from the ST app, I see the change in the Alexa app. However, the routine never triggers.

(Micheal ) #28

I have seen this as well. Seem Alexa does not actually reliably run ST routines even if they are ‘discover’ by the Alexa app. I would recommend using something like WebCore to run the routine and Alexa ‘speak’ whatever you want it to when the device state changes.


I’m clearly misunderstanding something then.

I created a virtual contact sensor that’s controlled by WebCoRE. When stuff happens, it opens the sensor. Then I have a routine in the Alexa app that tells my Echo to speak something when that sensor opens. I can see the virtual sensor open/close in the Alexa app, but the Alexa routine does not fire. What am I missing?

(Micheal ) #30

Oh…looks like like I am misunderstanding…however, THAT should work…I just created a virtual motion sensor with my app, put it in a routine and test it…seems to work as it spoke when I activated the motion sensor.

Are you sure you are activating the correct condition for the virtual device? It has to see the transition between one state and another.


I tested it by opening/closing the virtual device in the ST app. When I do that, I see it open/close in the Alexa app. And the Alexa routine is when it opens, say something.

(Micheal ) #32

I am not sure what is wrong…seems everything but the Alexa piece is working.


Yeah, I’m clearly doing something wrong, but no idea where. Also, if I manually run the routine in the Alexa app, the Echo talks. It just seems to pay no attention to the actual device opening/closing.

(Malcolm Hill) #34

Use Alexa switch


This issue is discussed in the FAQ on using the new Alexa feature. Most people with the problem have found that they have to disable the SmartThings skill in the Alexa app and then re-enable it. There is a condition that needs to be set on a sensor when it is first added to Alexa in order for Amazon routines to fire, and it looks like it doesn’t always get set if you’re adding a device after you have other devices already set up. If it doesn’t get set correctly, you can still see the sensor in the Alexa app, it’s just that the routines don’t fire from it.


That could be it. Now it seems I’ve run into a new problem. Since ‘upgrading’ to a Samsung account a few days ago, I can only add/remove devices from the IDE in Incognito mode. Also, I just disabled and (attempted) to enable the Alexa skill only it seems I get an error about ‘authorizing the selected devices failed’.

One step forward and two steps back…