Controlling an Alexa device from Hubitat

What exactly are you trying to accomplish? I have no idea how local endpoints as a RM Rule Trigger play any role without more context of what you're trying to accomplish?

Alexa can be used to control Hubitat devices, like switches, dimmers, color bulbs, and locks in Alexa Routine ACTIONS.

Hubitat Motion Sensors, Contact Sensors, and Locks can be used to TRIGGERS for Alexa Routines.

With those building blocks available, what would you like to accomplish? I am missing the point of the RM URL Endpoint as a RM Rule Trigger... :thinking:

Hmmm everything sets up in Alexa ok using a virtual contact, but not a virtual switch but nothing happens when I open or close the contact in Hubitat

1 Like

I was just use local endpoint as an arbitrary chioce -- I just want an example of how to trigger an Alexa action.

Separately my test virtual switch isn't being discovered by Alexa but I don't want to confuse the two directions. First I want Hubitat ==> Alexa to work so I can write a program to control Alexa via Hubitat (or Google Home but that doesn't seem to be supported yet).

test1 now works.

Hubitat web apps need to be upgraded to automatically save and/or warn. There are too my update buttons and save buttons that are easy to miss. This is why browsers have a feature to catch page exits.

But I still need to figure out test1=>Alexa.

I did ask "is test1 on" and Alexa said that test1 does not support that.

What is test1

test1 is a plain virtual switch

I use a virtual contact with switch

Yes, you can use a Virtual Driver that supports both the Contact Sensor and Switch Capabilities. This allows for a simple method on Hubitat to simply turn on and off the switch portion, while the same device on Alexa can use the Contact Sensor portion as an Alexa Routine Trigger.

1 Like

Thanks. Victory! I created an Alexa routing that responds to the contact closure! The virtual device was discovered automatically.

I didn't see a virtual device that does both -- do I need to create one? How? It's not important though becuase I can separate the functions.

FYI -- changing the device type does seem to automatially be reflected in Alexa but I should do more extensive testing at some point.

Rube Goldberg would be impressed.

1 Like

I knew that this might be your next question... :wink: I am working on an enhanced "Virtual Contact Sensor with Switch" driver and will post it in my GitHub once it is done. There are a few other ones floating around the Community if you're in a rush.

3 Likes

You can add a custom driver - I have just added this one to my GitHub repository that combines a Switch and Contact Sensor in one device. It also supports reverse logic if desired (e.g. flipping whether 'on' = 'open' or 'on' = 'closed') as well as an optional Automatic Off Feature. I also have a very similar driver that combines a Switch amd Motion Sensor in one device, with the same feature set.

The basic idea behind this combined drivers is that it is often more 'natural' on the Hubitat side of things to turn on and off a switch. But, if that switch needs to be able to Trigger an Alexa Routine, we have a problem (see aforementioned posts :wink: ) Thus, these drivers allow Hubitat to 'turn on' a switch, yet Alexa will see it also as a Contact sensor changing state, and thus it can be used to Trigger an Alexa Routine.

Likewise, Alexa cannot change the state of a Hubitat virtual Contact Sensor or Motion Sensor. But Alexa can turn on and off a switch device. Thus, you can also use this same driver for the reverse logic. For example, I have a Ring Doorbell that cannot be natively integrated with Hubitat. So, I created a Virtual Hubitat Device using my "Virtual Motion Sensor and Switch" driver. I then share this with Alexa. I created an Alexa Routine that is triggered by my Ring Doorbell sensing motion (using the Ring Alexa Skill integration.) As an Action of that Alexa Routine, I turn on the Hubitat Virtual Motion Sensor and Switch device. I have that Hubitat device configured to automatically turn back off so that it is ready for the next time Alexa needs to turn it back on. I then use standard Hubitat Apps to build automations based on the 'Ring Motion' sensor going active, like any other motion sensor.

With these device drivers, you can see how it is fairly straightforward to link Hubitat and Alexa together, where each can trigger each other as needed.

Hope this helps. Here is the Virtual Motion Sensor and Switch driver as well...

5 Likes

Wow, that is awesome! Not that I have Alexa only devices, but it sure will help a lot of people who do.

1 Like

Thanks! I'll look at it tomorrow and try to learn.

BTW, I notice that these post tend to have URLs. Use be nice to have a standard so I could just say "update" rather than having to copy each over manually -- unless there already is such a capability.

Are you talking about getting the code above into your hub?

If it’s a github URL:

2 Likes

OK, installed.

Each time I understand a little more about the platform. At least there is more native capability than when I had to program around SmartThings (before they were Samsung).

Okay - brand new to this, so go easy on me!

I just installed both the virtual motion sensor and contact sensor with switch, and that went as expected. The problem I have is that Alexa sees the device as a switch and not a motion or contact sensor as it should. Am I doing something wrong?

Ed

Probably not. You'll only see them available as motion or contact sensors when you create an Alexa routine and select a trigger.

1 Like

Okay - So I go to create the routine and add the new virtual contact with switch and it thinks it a switch, not a contact, and kicks out "ERROR: This device is not currently supported."

So, I take a step back and just create a virtual contact switch only to see if I can back into this by creating some rules to link a virtual contact to a virtual switch separately. When I add the new virtual contact device to the Echo Skill, it shows up in Amazon as a contact sensor, but when I go to add it to a skill, it kicks out the same "ERROR: This device is not currently supported."

:confused: