[Release] Virtual Alexa Switch/Button

For some reason, the Switch is being discovered as a switch in Alexa, as opposed to a sensor. It appears to be working in as much that i push the button and alexa sees it as on or off, but as it is a switch i cannot use it as a trigger in a routine.

has anybody else had this, i’m bound to be doing something stupid…

After several failed attempts I’ve managed to get a virtual sensor/switch to appear under Device in “When this happens” in Alexa routines. I had to log out of everything after completing the instructions and disable/enable Smartthings skill in order to see it appear.
I followed this https://thesmartcave.com/smartthings-with-any-alexa-device/
I found when I selected the device under “Choose Device” - it says
“Error This device is not currently supported” . The solution is, to quote @JDRoberts (to whom much thanks is due for other posts)
“Assuming that you are in the US or the UK, If you read the thread above from the top you will see that a number of other people had the same problem. All you have to do is disable the smartthings skill, sign out of the Alexa app, sign back into the Alexa app, reenable the SmartThings skill, and everything should work.”
And it’s now working: :smile:

1 Like

you need a DTH for a virtual device which is seen as both a switch and a sensor.

See the community FAQ, use the DTH in that FAQ, and follow the instructions exactly and you should be all set. :sunglasses: ( Don’t skip any steps even if you think you’ve already done them previously. They have to be done in a specific order.)

FAQ: Can I trigger an Echo Action without Speaking to It?

1 Like

Is it the case that I must have an ST hub to activate a virtual switch ? I have the switch/ sensor working in Alexa but hope to flip the switch from my own ESP8266 or Raspberry Pi. ST anything appears to need the hub.
Alexa already controls an ESP8266 using Sinric but that’s one way. I won’t be getting the hub so hope I’ve not gone down a dead end.

Do you know of any way to determine which echo device I am talking to? Scenario : I am listening to music in my shop (non-smart ceiling speakers) and my wife is listening to the radio in the kitchen (non-smart ceiling speakers). I have an Alexa routine (“Alexa, speaker volume up”) that runs a webcore piston to turn up the speaker volume. Unfortunately, it does so for all active speakers in my house. I COULD just make the routine “Alexa, turn up the speakers in the shop”, but I would like to be able to write webcore code that can query which echo device I spoke to and only increase the volume in that area of the house. I looked at Echo Speaks, but that is just overkill for me. Suggestions?

No idea, and that’s pretty off-topic for this particular thread so unfortunately you probably won’t get many responses here.

Why don’t you try asking in the webcore forum? That’s where most of the webcore experts hang out. :sunglasses:

Introducing the new webCoRE Community Forum

Sorry, yes, off topic. I thought that you might have some insight. I’ll pose the question in the webcore forum. Thanks.

1 Like

Hi sgnihttrams,

For me this was absolutely needed as all my Smart Lighting is Insteon. There is no direct integration between SmartThings and Insteon and I have been using Stringify to connect SmartThings and Insteon. However, Stringify is going away in July of this year. The Alexa system can integrate SmartThings and Insteon together but Alexa only uses Contact Sensors as Triggers (it can’t use Simulated Switches or Switches of any kind that is not associated with a Contact Sensor).

This Device Handler allows me to create a Virtual Switch/Contact Sensor that can be used by Alexa as a Trigger to Switch on or off of any of my Insteon Smart Switches for Lighting.

It works great and I do indeed use Webcore to Automate several of these Virtual Switch/Contact Sensors to allow Lights to come on or turn off at certain times.

Hope that helps provide a good reason for this Device Handler,

John

1 Like

Hi All, new to this community and just started with the ST maze. So I’ve copy and pasted the code as a dth yet I still can’t discover any new device in the alexa app. I’d appreciate if anyone could help

Works great, I have rm tasker that fake the devices as hue lights to Alexa. Then I installed the virtual switch/sensor to get it to smartthings… Just got one issue…

Anyone have any suggestions how to change the status on the virtual switch/sensor if not turned on within smartthings? Example if I trigger the routine with Alexa, then the status is not correct in smartthings.

1 Like

@Robert_Hols, I have the same and similar problems. A couple of my USB/Outlets can be controlled by Alexa but cannot be integrated into ST. Therefore, I do not always know the state of the plugs and cannot use ST or webcore to control them.

1 Like

WYZE SENSE MOTION DETECTOR AND ALEXA SPEAKING THE ALERT

Thank you for that device handler. I just purchased a Wyze sense motion detector. (5/12/2019). I wanted to integrate it with my SmartThings Hub and have Alexa report when there is motion detected. Here is what I did. It seems like a lot of work but it really wasn’t. It did take me many hours to figure out WHAT to do.

  1. In the SmartThings Hub I created a virtual switch named “virtual front door motion detector”.
  2. using IFTTT I turn that virtual front door motion detector switch on when motion is detected.
  3. using IFTTT I turn that virtual front door motion detector switch off when motion is cleared.
  4. I copied this device handler source code, “Simulated Alexa Button” and created a new device handler on my SmartThings Hub using the IDE. Google how to do that if you need to. It was easy.
  5. In SmartThings I created a new device, “simulated front door motion detector” based on the new device handler created above.
  6. In SmartThings I created an automation to turn on the simulated Alexa button if the virtual front motion detector turns on and another to turn it off in the same manner. The motion detector has a problem with my east facing front door when the sun is hitting my front door. It detects motion too often. So I have this automation only run from noon until 3 AM.
  7. In the Alexa at app I created a routine that would notice if the simulated front door motion detector turned on and if so it would play a custom message “front door, motion”.

I did something similar but simpler for the doorbell. I created another simulated Doorbell switch from the Device handler created above. In the SmartThings app I created a lighting app that enables the simulated doorbell switch when the real doorbell switch is enabled. In Alexa I have it play the message “doorbell, ring ring ring” when the simulated doorbell switch is enabled. Cool!

Worked great with my limited testing tonight. Time will tell.

My house has a lot of automation. I have a SmartThings hub. I have a Konnected security system. I have 8 to 10 smart outlets that turn on lights and fans, and night lights. I now have a motion detector directed at my front porch. I have light switches that are connected to the SmartThings hub. My security system is amazing. It recognizes when four different cell phones are near my house and disables the security system. It recognizes when all four are gone from the house and enables the security system. The security system texts me immediately if any sensor goes off. I have 5 Echo (Alexa) Devices. I can turn on and off the lights in my family room via Alexa. I can turn on and off lights in multiple bedrooms via Alexa. Alexa reports when any door opens, closes. There are a few things that are run by schedule. The front porch lights come on 1/2 hour before sunset and turn off 1/2 hour after sunrise. My bedroom lights and turn on via a schedule. The family room lights turn on at midnight. The living room lights turn on at sunset and turn off at 1 AM. I have a doorbell sensor and Alexa reports when someone pushes the doorbell and I get a text message.

I also have standalone occupancy and vacancy switches and dimmers throughout my house. For example, the lights in the kitchen are on a vacancy switch. If no one is in the kitchen, after five minutes the lights will turn out. The light over the kitchen sink is an occupancy switch and will turn on when someone walks toward the kitchen or in the kitchen. The bathrooms have occupancy switches and dimmers so that when someone enters the bathroom the light turns on instantly, and turns off when they leave. I also have a bunch of Wyze cameras.

1 Like

Thanks a lot for that device handler!!!

I started spending on smart home devices two years ago during a major renovation at my house. It was all new to me and being the noob I was, I purchased recessed lights for my whole main floor from Smartika(they were $25 each back then so pretty good). However, after setting all up I realized how dumb those lights are and that the only real smart thing about them is the voice control through Google/Alexa, they dropped their IFTT integration a few months after I got them, thus limiting me to voice control alone.

Now, thanks to Alexa seeing contact sensors and this device handler, I can finally use those lights the way I want! I understand that Smartika is probably going to go under in the near future but for the time being this is a solution to my problem. I can also see how other Alexa devices can be integrated into Smartthings. Great!

Edit: Another cool idea, when the virtual Alexa switch is pressed have Alexa turn on my Nvidia Shield! The switch is part of a ST routine that I have come up on Action Tiles and is also triggered by a motion detector near the TV at a certain hour.

There is a bit of misinformation out there, that this only works in the US and UK. So I tried it here in Canada, expecting it to fail. I hit the error message referenced in this forum. Removing the skill, logout, login, add the skill fixed the problem. I can now fully control Alexa from my automation.

The sunrise, sunset routine trigger is not supported in Canada yet. So that is the first thing I automated. I have a set of Insignia lights switches that only connect to a phone app and Alexa. The only option in the phone app is to specified fixed times. But adding a simulated alexa switch I was able to use WebCore to turn off the light at sunrise, and turn the lights on at sunsite.

My next magic trick will be to bridge my Wyze sensors through ITFFF to WebCore, to Alexa.

Thanks for making these.

I am having trouble though. I added both the switch and button handlers. Ideally I want this use to be a button, so I created a device, and discovered it with Alexa. Alexa sees it, and allows me to set up a routine triggered off of OPENED or CLOSED. In ST, I see an event for OPENED, but not for closed (along with “pushed”, “on” and “off”).

Either way, the Alexa Routine never fires. I can see the device in both ST and Alexa, I can push it in both apps and see the events in the Dev console, but it doesn’t trigger Alexa.

Note: When I look at the device settings in the ST app, it DOES NOT list Alexa as one of the SmartApps.

Quick edit: I created a routine to trigger off a contact sensor, and it works perfectly as soon as I create it… but the events it generates are STATUS->OPEN and STATUS->CLOSED whereas the virtual device is SWITCH->ON/OFF or CONTACT->CLOSED

@bjpierron Great tool but somehow for the life of me i can’t seem to figure it out what am i doing wrong?
I got both the button and the switch device handler installed…
I created a simulated alexa switch called Crown Lights on ST which Alexa discovered right up.
I went on Alexa and created a routine when Crown lights is open turn IPCO plug (a Alexa compatible device) ON and the reverse when Crown Lights is Closed turn IPCO plug Off …hoever when i stimulate it through ST nothing happens the device status on the ST app changes from open to close on and off but the Alexa routine does not trigger!
I went on Alexa and forgot all devices and rediscovered them again and re set the routines but nothing again
If i go on Alexa and click on play routine it works just fine for both on and off

here are a couple of screen shots from Amazon Alexa and ST IDE

What am i doing wrong and what should i do to solve this
anyone please help

Thank you in advance
Denis

@bjpierron - just wanted to thank you for this. My husband broke his jaw a couple of weeks ago so can’t talk for a few weeks (jaw wired). I’ve been able to set up a bunch of Alexa routines that he can access through a small ActionTiles panel on his phone that lets him play his music on Alexa. Very useful and inventive!

(Before anyone asks why I haven’t used real buttons, I’ve done quite a few things with real buttons, but I’m out of them and now can use virtual buttons)

3 Likes

I had the same problem but then followed the instructions on the wiki under “Activating Your Virtual Device” and now the device works great.

To activate your virtual device so Alexa can use it, do the following steps:

  1. create virtual device in the IDE

  2. use the smartthings app to approve Echo access to that device if you don’t have “all devices” approved.

  3. use the Alexa app to disable the smartthings skill.

  4. log out of the Alexa app.

  5. log back into the Alexa app.

  6. re-enable the SmartThings skill.

  7. ask Alexa to discover new devices

Your virtual device should now be available to trigger an echo routine.

2 Likes

Hi, Any chance to add a virtual alexa switch with percentage % .
For example if I want to set a volume of TV which connected to Alexa to 30%. I don’t need button of switch. I prefer something that I can set number and send it to my device.
Same as opening a window shutter to a certain desired percentage.
Is that possible ?

@bjpierron

I know I’m a bit dense, and often way behind the curve, but I think I just realized something about these device handlers that explains why I’ve been frustrated with trying to implement in my system.

I have been setting up automations using these in both directions, and it now seems like maybe they were only meant to get triggers from SmartThings passed TO Alexa, and not the other way around.

Is that right?

The reason why I’m thinking this is because, if I use one of these to send a click or on/off or a push TO Alexa, it works, every time. However, where I have configured them to receive triggers going FROM Alexa TO SmartThings, even though I can see that it says ‘button 1 was pushed’ in the ST logs, the webCoRE piston I have watching for the trigger NEVER actually does anything for me on the SmartThings side.

Am I right about this, or is it more likely I’m just using them incorrectly somehow?