Alexa virtual trigger

Let me throw this out and see if it is what you need. The easiest way to get a virtual switch to work with Alexa is to create one that also is a motion or contact sensor.

Virtual Switch/Contact for Alexa
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() {
}

Once the device has been created and added to your Hubitat Alexa or Echo app (Amazon Echo Skill app if your country is supported) then you should be able to use the virtual device to communicate through Alexa to your device.

6 Likes