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

I am pleased to announce the release of my Alexa Virtual Device Creator (was formally a virtual switch creator). While virtual devices are rather easy to create in the IDE, sometimes you are not near a computer and only have your mobile device with your SmartThings app. This app will allow you create virtual devices…either a momentary tile, a virtual motion detector or an “Alexa Switch” which is ‘stateless’ (meaning if you send an ON command to it while it is on, it will still allow ON to pass through to other apps. Usually apps have to see a transition from OFF to ON).

The documentation is here: Alexa Virtual Device Creator - Things That Are Smart Wiki

While these native Alexa routines are powerful, they do lack certain functionality. So, if you use a virtual device you can attach it via Alexa Helper, Ask Alexa or even WebCoRE to have actions occur when these device are activated or toggled. For routines, I recommend using a momentary switch since the on/off state does not matter…However, for the device groups within the Alexa app, I recommend using the Virtual Alexa Switch, where you can turn on or off the group…so the virtual switch can follow commands you give the group. Finally, for the new Alexa Routines that utilize motion detectors, the virtual motion detectors can be used to initiate actions.

Main app: https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/smartapps/michaelstruck/alexa-virtual-switch-creator.src/alexa-virtual-switch-creator.groovy

Virtual Alexa Switch Code: https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/devicetypes/michaelstruck/alexa-switch.src/alexa-switch.groovy

Momentary Tile Code: https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/devicetypes/michaelstruck/momentary-button-tile.src/momentary-button-tile.groovy

Virtual Motion Detector: Coming soon

The installation is rather simple:

  1. First, install both of the DTHs (virtual Alexa Switch Code and Momentary Tile Code)
  2. Then install the Main app code, saving and publishing it.
  3. Find The Alexa Virtual Switch Creator in your Marketplace and start using it

That is it…no OAuth, no other activity is needed. To use it, simply create a unique name for the switch, then the type of switch you are using. Again, here are the types of switches:

Momentary Tile Button: Think of this as a door bell. It is only on a moment to make your chimes ring. In the context of Alexa, she can turn it on, initiating some actions and she is done. If you initiate the action again it will work as they switch already ‘reset’ itself back to its original state. So, if you were to create a “good night” routine, you would probably use this type of switch as there is no real ‘on/off’ state…it is just a command.

Alexa Switch You can think of this as a virtual dimmer. It works similar to that type of device; you can turn it on, off, or set to a variable number. What makes this switch unique is that I have coded it as ‘stateless’. So, in some ways it acts like a momentary switch in its functionality as it will allow you to press on even if it is already on, and it will tell any app connected to it that you are pressing on. This may seem counter-intuitive, but most switches will not process the ‘on’ action if it is already in that state. This ‘passes through’ the commands. This type of switch is good for Alexa “Smart Home Group”, which allows you to control a group of devices within one command. This switch by itself is not very useful, but if you use it with other automations it becomes very powerful (see below).

Virtual Motion Detector As the name implies, this is a virtual motion detector. This virtual device that can be manually or programmatically set to a condition (motion/no motion). This type of device is useful use in Alexa Routines where the application can act upon a change in the motion (or no motion) condition of the device.

So the question becomes: how are these virtual devices useful? Well, by themselves they are not…however, things like doors can NOT be controlled by Alexa directly, so you need some sort of ‘proxy’ device that you can toggle to get the desired results from another application. If you are using Alexa Helper, for example, it includes its own virtual switch creator, and when you attach a switch to a scenario you are able to run all sorts of automations (including routines with locks and doors and such). If you are using Alexa Helper, you DO NOT need to use this app; it is included with Alexa Helper. However, if you want to create virtual switches on the fly and use them with things like WebCoRE or Ask Alexa (After I release the next version), this is the go to app for creating the virtual switches.

There are some limitations to this app:

  • If you delete the app (and the devices it created are not being used), the devices WILL disappear.
  • If you attempt to delete the app and the devices it created ARE being used), the app will NOT delete. You will need to disassociate the devices with the apps you have attached them to.
  • YOU MUST use the DTHs I have included above to use this app. It will NOT create generic virtual devices
  • You may not be able to delete the app if a device you created with it is still being used else where in SmartThings
  • When you create a device, be sure you ‘discover’ it via Alexa’s own app
  • If you manually create a virtual device via the IDE, it will NOT show up in this app (but it will also not delete the device when you uninstall the app). So, you could technically use the special DTHs and create your own virtual devices.

Please note the app does NOT give you the ability to delete a device or rename a device. Both of those functions can still be done via the IDE or via the mobile app.

9 Likes

Thank you for the quick turn around and getting this out to users.

I too spent last week at Amazon HQ, and while I am under NDA’s I can only share that we, both users and especially developers, should be ready to move quickly with new releases from hardware (Echo Plus ships this week), software, GUI changes, and more.

Your ability to remain agile and quickly release what can leverage the new Amazon features, and general support for our community is much appreciated.

3 Likes

Michael, I created a virtual Momentary Switch. I then added it to Alexa, and it works, but strange problem. I don’t think it is your app or DTH, but here goes.

I then created a WebCoRe Piston and an Alexa Routine. When I say “Alexa Emergency” the virtual switch is toggled and it activates the Piston below that turns on a number of devices. Switches, and sockets. The problem is that sometimes some go on while others don’t. Or when I repeat the “Alexa Emergency” to turn off the switches some go off while others remain on. Is it that ST can’t handle that many devices? I do notice a slow delay in the piston, and some lights come on in a delayed time period. Is this a normal problem?

PS. I think I figured part out. My cloud devices IE: WeMo switches are the ones affected the most.

Sounds like cloud latency.

Yes that is what I figure, so my test Piston isn’t practical, as two major lights for the use are cloud devices. Still I can see many uses for this. Looking forward to seeing how Ask Alexa will interact. I wish there wasn’t such a lag with the cloud, it would improve the ST experence.

Same GitHub repo?

That is how I set mine up. But I don’t see it in there. Michael will come back and clarify. I do see the momentary button tile in there. So I assume they all will be shortly.

Yes. For the devices and smartapp it is the same repo.

1 Like

I have started on the basis of the documentation here: http://thingsthataresmart.wiki/index.php?title=Alexa_Virtual_Switch_Creator

I have now called this version RELEASED. I will continue to work on the documentation, but feel free to use this app to create virtual switches which can be used with the new version of Ask Alexa: [DEPRECATED] Ask Alexa 2.3.3

Is there anyway additional capabilities can be added to the alexa switch? Maybe with an option to decide which are active on individual switches? Things like volume control attributes and and temperature commands.

I am looking for a slightly more flexible way to integrate my broadlink RM into alexa. There is a tasker plugin called autovoice which allows for creating virtual alexa devices that looks like it should do exactly what i am wanting however I can’t get it to reliably respond and fire. Thanks for looking.

Not sure what you mean by ‘additional capabilities’. This app just creates the switch…it would take a program like Alexa Helper or even WebCoRE to ‘link’ the switch to a function. That is how I have mine set up…I use a switch that Alexa trips to perform either an Ask Alexa macro, a function handled by WebCore, or even IFTTT items.

Hi Michael,
I have looked into the ask alexa apps. Seems a bit intimidating to setup and keep working. It is on my list of things to do.

So currently the Alexa virtual switch has dimmer capability and on off correct? I would just like to have more options such as volume control - So i could just Say "Alexa turn down volume on “virtual device”. Then have sharptools react to this change and trigger a tasker task. I am not sure of the proper verbage - i am just curious if other functions can be exposed in a virtual switch giving more flexibility in reacting to said devices.

Other uses I am looking for include for my ir controlled AC. I would like to say "Alexa turn up air conditioner and again have sharptools react and trigger a tasker task.

I am simply looking for a way to avoid saying things like turn on volume up television and make it a little bit more natural. If what I am asking is not possible no big deal. I think I may make mention of this in the sharptools thread as well. It just seemed like this option is most of the way there.

The autovoice tasker plugin actually has the exact functionality i am looking for, however like I said I cannot get the skill to respond properly.

I do not know if this is even possible - just thought I would put it out there to see what people who know a lot better than I to say yay or nay.

Ask Alexa is indeed difficult to install, but it is well worth it after you install it.

That is fundamentally correct. but again, it is how you link it to the devices that will allow you control. So while ‘volume’ won’t in a verbal sense, you can ‘increase’ and ‘decrease’ the dimming value, which works well from a verbal standpoint: “Alexa, increase {switch name}”. Then the backend automation will link the value of the dimmer to a speaker.

Make sense?

Yes it makes total sense :slight_smile:

I was just simply looking for a solution to make things easier for the kids and wife. Was just curious if it was really possible to add more controls possibilities to a single switch. Use case would be if i wanted to be able to turn the channel up and down and turn the volume up and down by calling a single a device. Sorry if I am not making my thoughts clear enough. No worries thanks for the reply. I am definitely going to read through the Ask Alexa documentation a few more times, eventually i will be brave enough to try the install.

In the meantime I am going to figure out why I cannot get this autovoice plugin to fire reilablly fore me lol - it actually should do exactly what I want if I could get it to work right. Was what made me think of asking for a similar type of integration with smartthings.

Here is a link for anyone interested. Seems this plugin could make our rm broadlink devices very versatile and flexible.

https://plus.google.com/+JoãoDias/posts/1W1Wfkd6hpZ

If you want to take on Ask Alexa, I can assist you if you run into difficulties.

I have slightly updated the DTH for the Alexa Switch (version 2.0.8) to give you the option of allowing the setLevel command to actually turn on the switch. Alexa Routines actually set the value of the dimmer but does NOT send the ON command…using this option allows that to happen.

https://raw.githubusercontent.com/MichaelStruck/SmartThingsPublic/master/devicetypes/michaelstruck/alexa-switch.src/alexa-switch.groovy

All,

On 9/1/18 or so, I will be deprecating this app and changing it to “Alexa Virtual Device Creator”. This will replace the switch creator and allow you to create a virtual motion detector so you can use it with the new Alexa Routines. Combined with WebCore, you can FINALLY do a form of push notification!

See you on 9/1!

EDIT I also started working on the documentation at the top of this thread so that it is relevant when I release the app this weekend! Enjoy!

2 Likes

Ok…I have posted the update. If you have the virtual switch creator you should see your IDE or your Community Installer show that an upgrade is available.

If you are installing fresh, here are the instructions:http://thingsthataresmart.wiki/index.php?title=Alexa_Virtual_Device_Creator

Basically, everything is the same, but now you can create virtual motion detectors to Alexa, which can then be used to trigger voice announcements. Be sure to load up the custom DTHs that come with the app as they are needed to support the auto-installation via the app of the devices.

These devices do nothing on their own; however, with some creativity (like with WebCore) you can do entry delays so that Alexa talks AFTER you have entered the house (presence and motion tided to a virtual detector).

Lots of fun stuff can be done with the new announcements…have at it.

Let me know if there is a desire for this app to create virtual open/close sensors. I don’t see the need since you already have a trigger mechanism, but you guys are VERY creative. Let me know.

I am trying to install fresh from github.

Update From Repo — SmartThingsPublic (master)

smartapps/michaelstruck/alexa-virtual-switch-creator.src/alexa-virtual-switch-creator.groovy

The response is…
Updated 0 and created 0 SmartApps, 0 published (1 skipped due to errors)

The 3 DTH’s installed just fine!

I’m I missing something?