Control/Add alarm on alexa?

Hi all.

I am not sure on where to find support for using a virtual button to control an alexa.
I have an Alexa Dot and ShowI wish to:
Change volume
Set alarm etc.

Is this something I can do with Echo Speak?
Have I integrated/authorised devices? I can only see devices I can control 'from' my alexa added to my HE Hub.

I am sure this is possible but haven't a clue which rabbit warren to go down.
Thanks in advance.

Create a virtual switch, under APPS>>Amazon Skill expose that switch to alexa. Use that switch to either A: Run a rule on HE, or depending on the status of that virtual switch, run a routine on alexa. (routines are set on alexa, so when virtual switch on, alexa turns on/off X)

Hi. Thanks for replying.
You say expose to Alexa.
It seems too obvious, what's not right?


Is Alarm 1 the virtual switch you created?

Alarm 1 and 7am alarm
Theyโ€™re a test switch
I have managed to get the to appear as an Alexa device.

Cannot see them to start a routine or do something.

Create a virtual switch/contact sensor or virtual switch/motion sensor. Alexa routines cannot be started by switches, but they can be started by motion and contact sensors.

Save this as a driver. Then change the driver on one of your test switches to this driver. It should now show up in Alexa as a contact sensor.

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() {
}
3 Likes

Perfect. This enabled me to use a Virtual switch to do what I want via Alexa.
Thank you

1 Like

Is the code something that is generated by the Hubitat itself, or is it something I have to write "by hand"? Thank you.

You can copy and paste it into a new custom driver. Here are instructions from the Hubitat documentation.

I'm lost; please forgive my ignorance. What custom driver do I want? I am not sure how to search for it.

You'll be creating a new custom driver. Follow the instructions linked in my last post to create a new driver. Then copy & paste everything that is below in the section titled "Click here to expand" into that new driver and click save. That will your first custom driver that you can use to create virtual device.

Click here to expand
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() {
}