SmartThings Community

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

smartapp_virtual

(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!


(TOO FLY FOR A FLY GUY) #23

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.


(TOO FLY FOR A FLY GUY) #25

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?


(TOO FLY FOR A FLY GUY) #27

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.


(TOO FLY FOR A FLY GUY) #29

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.


(TOO FLY FOR A FLY GUY) #31

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.


(TOO FLY FOR A FLY GUY) #33

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


#35

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.


(TOO FLY FOR A FLY GUY) #36

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…


#37

Wonder if someone can assist a new user…

I have recently purchased a ST (2018) Hub, 2 MP Sensors & 2 Motion Sensors. I will add more over time.

I have a piston set up in WebCoRE to send an SMS when an event happens but would also like to get one of my Echo’s to notify me that the event has occurred. (The Piston does work as intended so far).

I see that Alexa will natively tell me that one of my sensors is open/active but when I add a virtual switch or device, although Alexa detects it as a new device, I cant trigger a routine from it, only use it as an output.

I would like to end my Piston by turning on a virtual switch - Alexa detects that virtual switch has been turned on and then gives an announcement of my choice on my selected echo device.

Is this possible - if so, how?

I have also been trying to set up AskAlexa but run into difficulties but that is a another question!


(Micheal ) #38

Ask Alexa is definitely difficult to set up, but if you need help just let me know.

As for your question, you want the Echo to wake up and initiate a conversation instead of being spoken to first. Up until recently that wasn’t possible, but you can now with Echo Speaks. It is not fully supported by Amazon, but seems to work well for having the speakers wake on demand.

Let me know if that helps or if you want assistance installing Ask Alexa.


#39

There’s a simple way to do it, but there’s a trick to it. You need to create a virtual device which is both a Contact sensor and a switch. Then you can turn on the switch from smartthings, that makes the contact sensor look like it’s open, and you can trigger your Amazon routine (not a smartthings routine) from the contact sensor. :sunglasses:

See the community FAQ: it’s pretty straightforward once you get the idea of it. You don’t need an Amazon developer account or anything.


#40

@JDRoberts - Perfect - works like a charm!

FYI the piston is below, this triggers the new Virtual Switch to ON which in turn sets Alexa to:-

-Switch on a non ST Compatible Socket (Lamp is attached to this)
-Change Volume on Echo to 100%
-Play a warning message to check the Front door
-Wait One minute
-Lower Volume on Echo to 50%

I shall probably develop this and split the vibration and opening of the doors and have different Alexa Response. Again, thanks for the help.