[Release] Virtual Alexa Switch/Button

Alexa routines (not smartthings routines) Can currently be triggered by a Contact sensor or the Echo button device, but cannot as yet be triggered by a switch or any other brand of button.

One of the advantages of the echo routine is it lets you cause echo to speak a custom phrase, so it’s a really easy way to get verbal notifications.

Because smartthings allows you to create a virtual contact sensor, that means you can now cause echo to speak a custom phrase for any event that you can recognize in smartthings.

The only question left is how do you change the state on the virtual contact sensor so that echo will trigger its own routine.

There are two ways to do that. If you are already using WebCore, you can create a piston that will change the state of the virtual contact sensor.

But if you are not already using webcore, it’s probably overkill for this particular use case. Instead, you just use a DTH for your virtual device which will cause that virtual device to look like both a switch and a contact sensor.

That way it’s easy to turn the switch on and off just using the regular smart lighting feature, but because it is also a sensor, echo will be able to react to the changes. Turning the switch on makes the contact sensor look like it’s open. Turning the switch off makes it look like it’s closed.

But there’s one more issue that you have to deal with one one way or another: turning the switch off again so that it will be ready to use the next time.

By making the virtual device look like both a contact sensor and a momentary button, the OP Has something that turns itself off. The problem with that is it means you can’t set up an echo routine based on the “off” condition, but is long as you know that, that’s OK.

Another alternative is just to use power allowance on the virtual binary switch and have it always turn itself off after one minute. That will be enough for many people.

So different things work for different use cases, but the reason why you want to have a virtual device which is both a contact sensor and a switch is just because right now Amazon doesn’t let you trigger your echo routines from a switch.

And the reason you might want to make that switch actually be a momentary button is so you don’t have to figure out a way to turn it off again.

Did that help?

5 Likes