Virtual switch controlling an Alexa device

Hi all,
I feel like I’m missing something simple here…
I have some WiFi switches that are directly connected to Alexa, so as recommended here. I’ve created a virtual switch in HE and exposed to Alexa. Now trying to create a routine, but on the initial (when) action I don’t see my virtual switch to select, i only can see it on the Alexa Will action, but that would be other way around… what am I missing here?

Alexa is limited in that it will currently only trigger with sensors, not switches.

In order to trigger a rule with a virtual switch in Alexa, it needs to be a switc-sensor combo (like switch-presence, switch-contact or switch-motion).

I have done this and it works.


To add to what @Sebastien pointed out, use this driver from @ogiewon to create a virtual switch that is also a contact sensor. Expose this virtual device to Alexa. And then setup Alexa routines to control your WiFi device based on the status of the contact sensor. At the Hubitat end, you can control it like a regular switch.

1 Like

I've observed that in the last year or so Alexa can get confused with the virtual switch combined with sensor approach. I've had routines that stopped working until I changed from the stephack combo driver to just a virtual contact. I've not had a routine triggered by the single capability fail yet.

The difference on the Hubitat side is that you use custom action to open and close the contact when you want to trigger it, instead of on and off.

I'm certainly not saying the combo driver doesn't work anymore. As with all things Alexa, there is a bit of randomness associated with how it behaves.


I will agree with this even though I've not had any problems with my combo sensor/switches triggering routines. Except, I have recently noticed that routines that haven't been run in a while appear to get "stale?" for whatever reason.

e.g. I have a TTS routine, that hasn't run in about six months, which lets the person in a shower know the front door has been unlocked. I just turned on the contact switch and saw it turn on and off in the Alexa app, yet it failed to trigger the routine. I then manually ran the routine from the app and TTS worked. Turned the contact switch on again from Hubitat, and the whole routine ran as designed. :man_shrugging:


I use pure switches


1 Like

That's going in the other direction - an event in Alexa triggering an action in Hubitat.

You can't use switches for going from an event in Hubitat to an action in Alexa because you can't trigger on a switch in an Alexa routine.


Thank you all for the responses! So looks like the device type for Virtual Presence and switch is already there, i switched to it, refreshed Alexa integration, but it still not showing in the list of available "when" devices... So i supposed i still need to install the driver above..?

I think your only two choices for dual capability that works with Alexa are Virtual Contact with Switch or Virtual Motion with Switch, What using one of these does for you is the ability to switch the thing on and off in Hubitat, which is a bit more natural than setting a contact open and closed.

Having said that, I do believe that virtual contact alone is more reliable (for me), and you can set them open and closed via Custom Action in RM. Like this ...



There have been others who have reported this as well. But so far, my experience matches that of @bjcowles.


Added the driver and it works now. Thank you all!!