Use a Motion Sensor or Virtual Switch to trigger an Alexa Routine

A very good point. I've left requests with Alexa Support a couple times requesting the capacity to use switches.

A little while ago, I created a "Virtual contact with switch" driver (pasted below) using @cwwilson08's "Virtual motion with switch" pasted above.

This allows a single virtual device to be accessed as a switch at the Hubitat end and a contact sensor at the Alexa end. You might find it useful.

metadata {
	definition (name: "Virtual contact with Switch", namespace: "cw", author: "cwwilson08") {
		capability "Sensor"
		capability "Contact Sensor"
        capability "Switch"
	}   
}

def on() {
    sendEvent(name: "contact", value: "closed")
    sendEvent(name: "switch", value: "on")
}

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

def installed() {
}
10 Likes