Use Alexa for delayed implementation of command

IE: "Alexa, Turn off hallway light in 1 hour"
Anyone have any ideas on how to implement this?
I assume it is not really doable since i don't think either of the ways that come to mind are viable:
There is no mechanism for Alexa to "hold the command" for 1 hour.
There is no way to have Alexa build some sort of temporary timer in HE.
I know you could build a scene/rule combination with a set time, and a set device. But i am looking for something more adaptable to any device and time period.

Yeah that would have to be handled inside Alexa for the logic and then have Hubitat as the endpoint (hosting the hallway light in your instance).

You might be able to do some stuff in NR with alexa-remote2 (apple strudel), but it would be quite complicated and involve parsing out the spoken command (which isn't hard), but then you would have to match that parsed command to what you want (this is hard depending on how universal you want it to be), i.e. device, command, and delay.

You could do the quick and dirty way with delay and command nodes, along with the alexa nodes, or you could go fancy and use the generic Hubitat request node and that would make it basically 3 sections:
1 - Receive and parse alexa command
2 - Generate request command and delay amount from parsed command
3 - set the delay and send the request

Update: Upon further research, you can also use the command node, and just override the device, command, and arguments from the parsed message by changing msg.deviceId, msg.command, and msg.arguments for the input message so that is another option.

That's an interesting challenge. I think you could use alexa2-remote apple strudel in Node Red to pull information from what you said if said in a specific structure. However, Alexa would probably not be able to process the variability of what you said. If you were able to get implementation to work, Alexa would probably still respond with not being able to process your request regardless.

Hmmmmmmm....

1 Like

Yeah that is one annoying part of using remote2 for basically everything. I did notice a change this week though that makes this a lot easier:

Routines now can have 6 alternative voice triggers totaling to 7, so I have migrated my many "mask" routines into just a few. They still do not do anything except give the ding since alexa thinks she does something. I had to do this with "Turn on lights" as well since alexa's logic for that is garbage.

Have you seen this about creating an Alexa blueprint?

You can already do this with Alexa. Say Alexa, set sleep timer for switch in 1 hour.

5 Likes

Yeah I did, and I have it working as well, but I rather not have her respond with anything. Also IIRC when I set it up initially, the user interface was not great. Granted you wont be doing this a lot, but still.

Oh I didnt know that. Then yeah if this is the case, all you would have to do @tinker3433 is expose your hubitat based switches/bulbs to alexa and then just do it that way.

Me either. Can she turn on a light in an hour also?

Wow, that works. Who would have thought it was that simple? Works great for turning off a light. Now to explore what else it can do. To bad it is off only, no on function

Not as far as I know. It seems stupid they don't have that.

As long as we are on the topic, Another nice option would be "turn on xxxxxx for one hour"

Yes. Now, in and slightly before 2023, Alexa can perform delayed commands, such as "Turn on the Kitchen Light in 30 minutes."

But just as importantly, you can tell her to "Turn on the kitchen light for 30 minutes" and she will do the operation and undo it at the appointed time. (Works backwards as well... "Turn off the Porch Light for 1 hour" at Halloween time, etc.)

Not many Alexa users know about that last capability, but highly useful!

3 Likes

@DubbyDad It was a nice surprise (Alexa spontaneously mentioned it to me) to notice that they had added delays to turn on/turn off commands. Didn't know that DURATION was an option, very cool!

It's unfortunate that they did not created a generalized implementation of delayed requests; for instance, there's no way I know of to set a delay/duration for running an Alexa Routine or playing music.

1 Like