I've not really had the need to use a virtual switch with Alexa for obvious local reasons. However I bought some outdoor lights which I needed to integrate with Alexa.
Long story short but my routines don't always execute and it seems to be that HE isn't always talking to Alexa. When I execute the routine manually via a Alexa, the routine works perfectly fine. So I'm questioning my HE virtual switch and it's reliability. What is the best HE virtual switch which integrates with Alexa, I'm currently using "Virtual contact with switch (user)"?
There is no reason any virtual driver (supported by Alexa, as this one is) shouldn't work. How are you using the switch to activate the Alexa routine, and how is the virtual switch set up? A common mistake is activating the routine based on something like motion active or contact open (which with a driver like this normally corresponds to the switch turning on) but not "resetting" it to inactive/closed/off again, meaning no event will be generated the next time you turn it on. No event, no activation.
Most virtual drivers like this provide some sort of "auto off" option for this reason. It's probably a bit farther up on the page than your screenshot shows. This is just one possibility, but a common one.
In the past, I had a problem with Alexa routines not triggering when I used contact sensor as the device capability, but with the motion sensor capability it worked every time. No one else had this issue but me. Today, I no longer have this problem.
@stueyhughes If you copied that code from the forum, check to see if the line // runIn(1, off) exists. If it's there, just remove the // and the switch will turn off after 1 second. If it's not there, you can just add it. It will look something like this...
On a related note, looking at Alexa Routines today, it appears you might no longer need the "sensor workaround"--when I choose the "trigger" (When this happens...) for a Routine, I can see switches and can choose "turned on" or "turned off." However, I think all the ones I have are really dimmers or bulbs, so I can't tell exactly what devices it's allowing. But I think this is more than before, and it's possible a regular switch would work too...the way this would all make lot more sense, if they did.
Hi guys, sorry for the slow response. I think I've figured out what the issue is here. I'll report back when I know for certain but it seems that if the switch is toggled too quickly (so on then off or vica versa) then Alexa doesn't seem to keep up and loses track of the switches state.
So if I then toggle the switch back to on, for example, Alexa thinks the switch is already on and doesn't see the state change. That's my hunch so far.