Most people just use the existing virtual device types. So you just add a new device and assign it to one of the existing virtual device type handlers.
So just sign into the IDE and go to “devices” then choose “+ new device.”
And then under “type” choose the type a virtual switch you want. If you want one that will turn itself off every time, choose the “momentary button tile.”
You shouldn’t need to write any code if all you want is to have a virtual switch Run a routine. That’s what this thread has been about. Once you have the switch, you can just have echo turn it on. ![]()
-
create a virtual Switch (not a dth–use one of the existing DTH’s)
-
create a routine that does everything you want and have it automatically turn on when your virtual switch turns on. If you use a virtual binary switch, also have the routine turn the switch off again. Otherwise use a virtual momentary switch
-
now you have a routine that will run when that switch turns on. If you want to do it through echo, just authorize the switch to echo and when you tell echo to turn it on, your routine will run.
If you want to do it with any other automation, including the official Smart lighting feature or core, since the virtual switch should show up in your list of switches, you just select it as normal and again the routine will be activated.
So why were we using IFTTT?
So it’s really pretty simple now. You only need IFTTT if you want to use a custom phrase to start the process. You don’t need an extra smartapp. You just need a routine that runs when a specific switch comes on, and a virtual switch that echo has been authorized to turn on. ![]()
If what you’re trying to do is have echo run that routine using a custom phrase , it’s exactly the same process for 1)-- create the virtual switch. Then you use the Alexa IFTTT service custom phrase as the “if” and that virtual switch coming on as the "that"in your applet.
So your two choices are:
“Alexa, turn on movie time” where “movie time” is the name of a virtual switch that will automatically start the routine you want to run. No IFTTT needed
Or
“Alexa, trigger movie time” where “movie time” is the custom phrase in the Alexa IFTTT service. You still use a virtual switch to automatically start the routine, but you don’t use the switch name with echo. You use your custom phrase.
Some people find there is less lag if they leave IFTTT out of the picture. Other people prefer to use custom phrasing rather than always having to say “turn on.” Choice is good. ![]()