[Release] Virtual Alexa Switch/Button

dth_virtual
alexa
dth_alerts
project_alerts

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


UPDATE!!! - THIS WORKS AMAZINGLY AWESOME!!! THANKYOU SO MUCH FOR SHARING THEM!!! ANYTHING THAT ALEXA SUPPORTS IS NOW WORKING WITH SMARTTHINGS!!!

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)

Example:

  • 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

@bjpierron

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?

e.g.
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

@bjpierron

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?

Final:
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?

EDIT:
OK…so, this is dead then?


(John Magrane) #27

just stumbled on this and I love it. I’ve been controlling my AV system with the Logitech Hub, but you can’t get control of an individual device outside an activity without a lot of heavy. This lets me implement those controls. Thanks.


(Mark H) #28

Nice! I have a Fire TV Cube which creates devices that can be used in Alex but not SmartThings (ie; TV, Soundbar). With this DTH I can turn on/off the TV/Soundbar through SmartThings via an Alexa Routine.


(JoAnn) #29

I am trying to control multiple C by GE C-Life bulbs in SmartThings…I know that these bulbs are NOT SmartThings compatible because they use Bluetooth… but I would really like to trigger these lights in webcore with my other smartthings devices. Alexa does see the C-Life light bulbs (C-Life bulbs are NOT IFTTT compatible)… So I created the “Alexa switch” virtual device. Both Alexa and Smarthings see the “Alexa switch” virtual device but Alexa does not see it as a contact sensor(which does not allow me to use it in a Alexa routine) what have I done wrong? Was I suppose to do a custom code? I did not do custom code I used “Alexa switch” for the type of virtual device…please help

Update:

Well I FINALLY figured out what I was doing wrong!! I definitely CAN CONTROL ANY OF my C by GE smart [C-Life light bulbs] lights through Smartthings. So now any device (that can be seen) in Alexa can be controlled in Smartthings (so I can use webcore to develop complex logic to control my house). So now I do not have to worry about if a product is compatible with any specific Hub.

I had to create a simulated contact sensor (device) in Smartthings (account.smartthings.com). Tell Alexa to discover devices. Then disable the “Smartthings skill” in the Alexa app, log out of the Alexa app. Log back into the Alexa app and enable the “smarthings skill”. Go to Routines in Alexa and use the “simulated contact sensor” I just created as the “when this happens” section [choose “Device”] (select the simulated contact sensor) and tell it to control my C-Life light bulb.

Create 2 Routines for each Bulb (one for Bulb on and one for Bulb off). NOW tell Alexa to discover devices again! Now I can control the lights by going to smartthings app and control the simulated contact sensor.

I know it’s a round about way of controlling a device but these lights bulbs only use Bluetooth to talk

I appreciate everyone that took the time to make suggestions in this forum and other forums. Thank you all


(Ron Czapala) #30

I have been using a virtual Alexa switch that is turned on by IFTTT - triggered by a Google calendar event: “If an event from search for ‘medicine’ starts on [my gmail address] then Switch on Alert switch”.

I have an Alexa routine triggered when “Alert Switch opens”. It turns on particular light and announces “Give the dog his medicine” over all of my Echo devices. It then waits one minute and turns off Alert switch.

My dog gets a certain medicine every other day so I have an event set up in Google calendar that repeats every other day.

Very handy…


(Miran Dalic) #31

For some reason switch aka contact sensor turn on by self, is that normal, in IDE log I am getting that initiator for changing state to on (switch) and open (contact sensor) is DEVICE ? How is that possible that virtual switch - sensor can do it from nothing ? :smiley: