SmartThings Community

[Release] Virtual Alexa Switch/Button


(Nate Hales) #21

Im going to try to use this to solve the following:

  • Bought some Merkury $12 LED Color changing bulbs from Walmart (That are awesome btw)
  • Bulbs with Google and Alexa but no Smartthings support for this brand (that I could find).
  • Use what he has built here to have Alexa recognize my normal Z Wave light switch as a contact sensor. So when I turn on the main living room light, Alexa will see the existing z wave light switch turn on (open), and will turn on the two extra lamps with led Merkury bulbs in them. I will be attempting to have the opposite happen when I turn the switch off (close).

I do not use webcore so I am going to try it without webcore. Any advice is welcome.


Clip from my reply to the another post:
“As of this post Alexa can only uses sensors as triggers (no support for switches) This thing, in the link, makes it a sensor and a switch at the same time, so it shows up as a sensor in alexa routines and shows as a switch in smartthings). I know this will be helpful for someone like me trying to save some money on color led bulbs. I bought some Merkury $12 LED Color changing bulbs from Walmart (That are awesome btw)”

  • Tip: After you make the Device Manager (in Smartthings back-end) and you are making your switch (aka smartthings device) Make sure you select the Type “Simulated Alexa Switch”. Then refresh and have alexa discover devices. You will see it as a switch in Smartthings and as a contact sensor in Alexa (this switch can now be a trigger)


  • I manually flip on the main livingroom light switch (a regular Z wave switch),

  • It sends the signal to Smartthings that the switch has been turned on,

  • I use the Smartthings SmartApp "SMART LIGHTING " with a custom rule to turn on (or off) “Simulated Alexa Switch” whenever the main living room light switch is toggled.

  • Then ALexa sees this “Simulated Alexa Switch” as a contact sensor (Open = On / Closed = Off)
    Then I just build a good alexa routine

  • Yes I did need the Gennie app for the wifi bulbs to set things up in there as well.

This should be enough to get started if you have a little Smartthings back-end experience. So if you can make a device handler (bu copy paste form gethum then this is a task you should be able to do no problem .

Final tip: If it is not working after your done, you may need to disable Smartthings in your Alexa App and then re enable it.

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #22

I’ve been considering those (I already have other things connected in the way you described for the simple on/off thing), but was waiting to see if there is any way of managing color.

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #23


I may be missing something (quite often the case), but…

I have been using your ‘momentary button’ version, but for some reason, it’s not actually showing up as a momentary button to act on in webCoRE.

Up till now, it seemed to be working to use it just as a switch type anyway, but now it’s not…or at least not consistently.

EDIT: this current problem could be due to the ST system problem that’s currently happening, but still…

Is there a chance you could add in the code needed for it to ACT like a momentary button, to be able to use it in webCoRE (or other) as a momentary button?

If ThisMomentaryButton gets Pushed, DoSomething.

(Bill) #24

Am I missing something . . ??? I create device handler, publish . . then what? I cannot get to show as device . .help please!

(Bill) #25

OK I’m good found the documentation . .

(ocpd+adhd+alz+md+hfa+fms+lol=me :)) #26


OK, I have looked around, and tested things, and I’m still in the same place.
I have three Echo Buttons in use.

One is for my bedside button to toggle a certain Philips Friends of Hue Iris light on and off. In that one, I am using a simulated switch, and simply turn it off in the webCoRE piston after t turns on.

The second one is being used for a similar thing at my folks’ house (in their own SmartThings system) as my Mom’s ‘contact son’ button. i.e. she presses it, and it sets off a series of different things to attempt to get in touch with me (sends text messages to all of my phones, flashes the Hue lights in my office with her favorite color, and speaks a message out loud through my Amazon Alexa devices). This one also uses a simulated switch, and the webCoRE piston turns it off after it gets turned on.

In both of those cases, it works just fine. The only draw-back is the fact that there is an extra line of code in the webCoRE piston to handle turning the simulated switch back off after it gets turned on.

The problem is with the third one that I have implemented. In this case, I have your Device Handler in use. The goofy thing is the fact that, even though it claims to have momentary capability as I read it in the code, and even though when pressed, it reports that a button got ‘pushed’, when it comes to creating a piston using this device, button is NOT available as something to act on; the only things available are 1. contact, 2. switch, and 3. $status

So, since the only logical choice is ‘switch’, I use that. i.e. the piston watches for the switch to turn ON, and then performs the configured automation.

The problem is that, when this happens, it almost NEVER actually works. Once in a great while, after about at least a minute delay, it does actually follow through with performing the automation, but most of the time, nothing happens at all, and I have to take out my phone, and act on the light that was supposed to turn on manually in the SmartThings app.

So…Please tell me… is there something that can be done to make it so that BUTTON / MOMENTARY / WHATEVER YOU WANT TO CALL IT is available when using this device handler in webCoRE?

Is it supposed to be there, and mine is just messed up or something?

OK, I just went back in, and changed it to use a ‘regular’ Simulated Switch, and added the line of code back into the webCoRE piston to turn it off again after it turns on, and it now works just fine like the other ones.

So, somehow, there’s definitely something not working right about this Device Handler in my setup.

Any ideas?