Run a sequence of events with a virtual switch

I have been through some of the help replies here, but am too much of a Hubitat newbie to speak the language yet. Here is what I want to do:

I want to move as many of my Alexa/Echo Routines over to Hubitat for reasons of wanting stuff "local". Every device I wish to control is local; nothing is cloud based.

One routine is "Bed Time". It is "me activated" and duplicates a Routine, "Night Time Shutdown", that runs automatically each evening if I am not here. It shuts down lights in a sequence that gives the appearance that someone is home and does it at set time.

The "me activated" one does the same thing, but with a voice command.

What I want to do: Be able to say to Alexa "Alexa, bed time" and have it run the Night Time Shutdown steps in the Hubitat. I believe I have enough skill to build the routine in Hubitat's language. What I don't know is: how do I do this with a virtual switch? If the switch goes from "off to on" to run the routine, does the switch need to go back to off when the routine is done? Or, is there something called a "virtual button" or other momentary contact that will trigger this?

Thanks in advance, folks!

At the end of the rule, set the virtual switch to Off. I do believe that you will still be dependent on the Internet to have Alexa respond.

1 Like

After you create the virtual switch, you can set Auto-Off from 500ms to 5s.

6 Likes

Nice one. I never noticed that option on the virtual switch before.

I don't know if Alexa does now but I know she didn't use to recognize a button and this was the workaround to a button for Alexa.

1 Like

As mentioned before, you will need to use a switch as Alexa cannot currently control buttons. My first choice is what @stephen_nutt recommended - use the virtual switch driver’s option to turn it off automatically.

You could create a rule in “Basic Rules” with that switch turning on as a trigger.

Basic rule allows you to complete an action, than another, than another, etc. Rule Machine would allow you to do the same and add some complexity if you need it. Starting with a Basic Rule will likely be easier.

Give it a try, and if you get stuck at any point, just ask and someone will be happy to help you get unstuck!

At least with the virtual switch you can still operate the switch from a local dashboard if Alexa is down.

1 Like

I do similar and consider them my most useful automations. I have virtual switches on my dashboards called 'Goodnight' and 'Good morning'. Both are set to turn off automatically after 3 seconds (3 seconds gives me the indication I need on the dashboard tile). Both virtual switches could be triggered via Alexa (though I usually prefer to tap the dashboard tile) I have the 'Goodnight' one - turn off media (via Harmony integration), turn on living room lamp, close curtains (if open), turn off garden lights, turn on alarm system (if off via smart implant) turn on stairs, landing and bedside lamps, reset thermostat (if overridden). After a 90 second wait (to get upstairs) it turns off any unneeded lights. The 'Good Morning' one opens all the curtains (except bedroom), unsets the alarm (only if set), switches the TV on and sets it to my preferred channel.