Alexa virtual trigger

Hi

I just got a hubitat and setting it up came across a "seem to be easy" problem but can't find a way out.

My setup,

Yeelight bulbs

Lanbon l8 switches

Amazon echo

Google home

Xiaomi hub

Aqara motion sensors

Aqara door sensors

Philips HUE hub

Philips HUE motion sensor

Philips HUE lights

And off course Hubitat elevation

The problem,

I create an Aqara virtual door sensor and make two routines in alexa so when Aqara door sensor is open, turn on Lanbon l8 switch.

When close, turn off Lanbon l8 switch.

In Hubitat,

Inside properties of Aqara virtual door sensor, when press "open" triggers alexa On routine and turns on the Lanbon l8 switch, when press "close" triggers alexa OFF routine and turns off Lanbon l8 switch.

I try to use a button in dashboard (tried almost all) when pressed to call the "open" or "close" of Aqara door sensor so I can control the Lanbon l8 switch!

But I can't find any tile that can call specific function of a device.

It seems so simple but yet...

Any ideas?

I don't believe you can configure a tile to call commands on a device directly, but I'll leave others to confirm that for sure. What you can do is setup either a virtual button or virtual switch to use as the control mechanism in the dashboard and setup rules or other apps to respond to those buttons or switches being controlled in the dashboard. Does that make sense?

It's not a neat as what you are describing and it would be nice if we could call commands natively, but that is the best I can come up with myself. Let me know if you need a hand with setting it up and I can provide some more details.

Simon

Thank you for your answer!

To tell the truth I didn't understand what do I have to call through the rules.

The initial problem is that alexa can use as triggers only sensors like motion and door or lock or alarms.

But it's the intermediate between Hubitat and devices that Hubitat does not have any control on!

If you can make a virtual trigger for alexa, you could control Lanbon and Broadlink m4 pro that I also have and forgot to mention.

I also seen in other posts that various people trying to control unsupported devices from Hubitat.

So my idea was, why not use alexa? She already controls them. But you need one of her triggers.
You already have various in Hubitat but can't call them by will.

Thank you

Hmmm....

I don't use Alexa (I use Google), so I may need a little assistance there, but can you not link a Virtual Switch configured in HE with Alexa? Actually, reading your last post again, are you saying that within Alexa you can only use sensors for triggers, so even if you can expose a switch from HE, it can't be used in routines?

Anyway, if you can get a Virtual Sensor in HE to trigger Alexa routines, then I suspect this is all you should need to do:

From the Devices page in HE, create a new Virtual Device, selecting Virtual Switch as the Type (driver)
Add this Virtual Switch to your dashboard, using the Switch template for the new tile
Confirm adjusting this on the dashboard adjusts the status of the device
Install the built-in App Rule Machine, if not already installed
Open the Rule Machine App and Create a new Rule
Create a Trigger for the Virtual Switch changing state
Setup a conditional action (not a simple one, IF-THEN-ELSE)
If the Switch is on, run a custom command of open on your Virtual Sensor device
ELSE run a custom command of close on the Virtual Sensor device

There's some major assumptions there and a few steps skipped over maybe.... If you plan to give it a try and need some more info let me know.

Simon

As @sburke781 says, virtual devices can make the bridge. Switch changes are seen on both sides. Rule machine changes virtual switch and triggers Alexa. Alexa changes virtual switch can trigger rules on Hubitat. Of course you have to install the Alexa app and select you're virtual switch to expose to Alexa.

1 Like

So Alexa can respond to switches, not just sensors in routines? I wasn't sure if there was a restriction on that or not. If there isn't, and you can use switches in Alexa, then the virtual sensor in HE and the use of RM would not be required, triggering the switch on the dashboard should be enough, if the Alexa integration app can pass on the state of the virtual switch to Alexa to respond to.

Not 100% sure what you are trying to do , it's late and my reading comprehension is not good right now. Would using the custom commands in Alexa help you?

If you can trigger something in HE then you can basically spell out the phase you want to send to Alexa using Echo Speak's sendcommandastext. ie, "Alexa, turn on switchname"

Basically if there is a command you can speak to Alexa to have it do what you want , then you can make HE send that command to Alexa via RM or webcore..

I was able to move my Leviosa shades off of ST using this method. When a virtual shade is adjusted on the dashboard I use a RM rule which then tells Alexa to open or close the shade it corresponds to. My shades have a ST integration and a Alexa integration but no HE integration.

1 Like

Thank you all for the answers.

Unfortunately I didn't manage to do it.
RM confused me very much although I tried multiple times and echo talks doesnt even has documentation to know what to do.

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

You are great mate!

Your driver worked like a dream!

Thank you!

2 Likes

This driver finally allowed me to see my Ring Motion and Contact sensors in Hubitat through my Amazon Echos. I was already able to see the motion and light status from my Ring cameras through Hub Link to my old Smartthings hub. I can now use them for automations. Thanks!

1 Like

Wait, driver? What am I missing? And can you access lights / siren in Ring devices from Hubitat via Alexa? I'd REALLY like to be able to trigger my ring sirens and turn on lights should somebody, somehow manage to get past them in the first place and gain access to the house and trip the alarm...

The driver code was posted by @thebearmay two posts above mine. It allowed me to create a vitrual switch/contact sensor that the Echo could control without adding it to a group.

I can now get info from my Ring Alarm motion and contact sensors. I setup routines in the Alexa app to turn each virtual switch on/off based on the state of the Ring motion or contact sensor that Alexa sees.

My Ring cameras were already available in HE through Hub Link to my Smartthings hub that I keep around for the few things I can't get into HE yet. Smartthings has a Smart App for Ring so I can get the camera motion info from there, The only other thing I have on the Smartthings hub is the SmartDry sensor in my dryer.

I just tried this. I created the virtual device with this driver and added it to the Hubitat "Amazon Echo Skill" app. Alexa announced it now knew about the device. In the Alexa app, when I tried to select this device as a trigger for an Alexa routine ("When this happens" -> "Smart Home"), I get "This device is not current supported". The icon on the device is a light bulb. I also exposed a motion sensor and it shows up on the same page, and it gets the same error.

What am I doing wrong?

UPDATE: Got this to work by simply closing and re-opening the Alexa app. The error went away after that.

1 Like

In the code, I swapped the closed/open values, because I wanted the contact closed when the switch was off. It just lines up better in my head that way. (and it looks better in the Activity Viewer app).