Creating routine in Alexa app for a virtual switch

HE experts,

I'm hoping you can help. I am trying to set up a routine with Alexa running a HE virtual switch. My hub is linked with Alexa and the virtual switch is added to the app. Here is my issue:

In the Alexa app, I locate my switch and hit "create routine". I tap the + button in the upper right corner to create a new routine. I name the routine and hit the + in the "When this happens" portion.I chose "smart home" and it tells me "no devices found. to start a routine with a smart home device, add one in the Devices section of the Alex app". I am going around in circle.s What am I doing wrong? Any help would be so appreciated!

Thanks in advance.

Alexa doesn't permit switches to act as triggers for routines. Only sensors (contact, motion, leak) and locks.

So you could make a virtual contact sensor in Hubitat and expose it to Alexa. And use activation of the contact sensor as the trigger for your routine. You could also use a simple virtual contact/switch driver like the one listed below, which can be triggered as a switch in Hubitat and use as a contact sensor to trigger an Alexa routine.

Virtual contact sensor with auto-off switch
metadata {
	definition (name: "Virtual contact with auto-off Switch", namespace: "aa", author: "aaiyar") {
		capability "Sensor"
		capability "Contact Sensor"
        capability "Switch"

preferences {
        section {
		    input (
                name: "AutoOff",
                type: "bool",
                title: "Enable auto off", 
                required: false, 
                displayDuringSetup: false, 
                defaultValue: false

def on() {
    sendEvent(name: "contact", value: "closed")
    sendEvent(name: "switch", value: "on")
    if (AutoOff) {
        runInMillis(500, off)

def off() {
    sendEvent(name: "contact", value: "open")
    sendEvent(name: "switch", value: "off")

def installed() {

I like using “combo” sensor/switches for this purpose. There are now two available as part of the hub, a Motion with switch and a presence with switch. Either will work for this purpose.

1 Like