Controlling an Alexa device from Hubitat

Have you manually cycled the virtual contact sensor from open to closed in the Hubitat UI? Need to make sure it has a value that displays correctly in the Amazon Alexa app on your phone.

Once you get it working in Alexa, you should be able to change the driver type of the virtual contact sensor to a driver that supports both contact sensor and switch capabilities.

1 Like

I did try that - but no luck.

Having said that I did create a virtual motion sensor and Amazon DID see it appropriately. I then was able to create a Echo routine that locked my WiFi Schlage lock when it "detected motion" by using the voice action of, "Alexa, set volume to 0 and lock my front door". Conversely I created a routine that would unlock the door with the voice action of, "Alexa, set the volume to 0 and unlock my front door with pin 123456".

So - this is a step in the right direction, however to really make it work I would need to create a separate virtual switch and fab up some rules that would toggle the motion sensor when the switch is toggled.

Ideally, I'd like to have the motion sensor with switch combo functioning to avoid the extra overhead but every time I try to use the driver above, it shows up as a switch, not a motion sensor. I'm not strong in terms of coding, but I couldn't see an obvious priority for the virtual device to present itself as a motion sensor only.

Thoughts?

Virtual Locks work in Alexa as well, as triggers for Alexa Routines. That may simplify things.

Ah! I did not know that. I thought that you could only use virtual contacts or virtual motion detectors.

I will try that next!

Thanks for the tip.

1 Like

Alright - That did the trick!

  • Created a virtual lock
  • Added virtual lock to Echo Skill App
  • Created Amazon lock routine with voice command, "Alexa, set volume to 0 and lock my front door" when virtual lock is set to lock.
  • Created Amazon unlock routine with voice command, "Alexa, set the volume to 0 and unlock my front door with pin 123456" when virtual lock is set to unlock.

All is well and now I can activate my WiFi Schlage from HE using Alexa. In fact - it is the ONLY think I am using Alexa for.

Thanks for the guidance!

Ed

2 Likes

After reading this again (I must have started on a similar thread a couple years ago, I finally understand these hybrid devices of ogiewans. I'll say my understanding, which is only useful if it helps someone else "get" this.

Alexa mostly deal with controlling devices (we'll call them the output) based on input by voice or a few other things. So for example, a "switch" is an output device to Alexa. Alexa can turn a switch on, but a switch can not cause Alexa to do something.

An example if the "few other things" that can be input to Alexa are contact sensors and motion sensors. HOWEVER, a contact sensor or motion sensor can't be used as a device activated by a Hubitat scene or whatever. So the magic contact sensor with switch is a two-ended device. It looks like a switch to Hubitat so H can control it with a scene, but it looks like a contact sensor to Alexa, so it can trigger a routine in Alexa. COOL!

BTW, there seemed to be a lot of trouble earlier explaining what we wanted to do. I think I can say it simply: We have a device like an APC power strip or any number of other "hubless" devices that work with Alexa and their own app but nothing else. We want to control them with a hubitat scene or simple automation. So we have to be able to hit a hubitat switch and have it run a routine on Alexa.

I hope this helps someone else, and I thank everyone who worked on these drivers and made it happen!

6 Likes

Here is a Universal Virtual Switch Device Type, made for Alexa, IFTTT, and other integrations. It is similar to the UDTh from SmartThings. It is a Virtual Switch that can also be a motion, contact, presence, smoke, water, shock, battery, sleep, and valve. Just select the features you want. Also has the ability to automatically turn off after a certain period (good for virtual motion sensors).
For Alexa Integration, you would select either Contact and/or Motion sensors as those are the only Triggers in Alexa Routines. You can then Open/Close or set Motion/No Motion in Hubitat by turning the Switch On or Off.