Help with a new rule. Using speech device to hold a local variable

Hi all,
Not sure if this is possible, but would love to add this capability.
Rule storyboard as follows.

  1. Some event happens which opens the garage door
  2. 5 minute delay
  3. Alexa asks, “the garage door is open. Would you like me to close it?”
  4. If response is , “yes” then close garage door
  5. If “no” or no response then ask, “would you like me to ask again later?”
  6. If “no” or no response do nothing
  7. If “yes” ask “ok, how long should I wait to ask you?”
  8. Place response into some time variable
  9. Delay for specific time variable return to 3

My brief search sugggests this may involve setting up an aws lambda and new skill and possibly node red, though I figured I’d ask before trying that because it honestly looks daunting. If possible I’d much rather set up some way for my Alexa to obtain a local variable through RM.

You certainly can do that. However, there is a simpler way.

Create two virtual switches, named yes and no with auto-off after 1 second. Link them to Alexa. In Alexa, set up a routine where saying "Yes" or "No" turns on that virtual switch. Then, set up your announcement though whatever means that you set it up now. Then wherever you are making the announcement, you set up a series of actions or rules based on the actions you spelled out. It could be one big one or several smaller ones. But in a nutshell, that's what you'd do.

However, there's one caveat, you won't be able to say "Yes". You would have to say., "Alexa, yes". Because you'd have to speak the wake-word because she's not really waiting for a response.

@aaiyar introduced us to this node pallette in another thread that might have potential to do some of what you want: node-red-contrib-alexa-remote2

Documentation is severely lacking but I have been digging into the responses that each of the Nodes make. At this point, I have found msg.payload.description.summary coming from a Hubitat Device Node gives text that can be acted upon using Regex matching. Take a look.

There are some Hubitat Nodes in Node Red thanks to @fblackburn

But wouldn't that be Alexa's reply to you, not your reply to Alexa? To get Alexa to wait for a response requires some code on the Amazon side. You just can't flip a switch and make that happen.

I just started digging into the pallete yesterday so I am not an expert but I have found that msg.payload.description.summary is what Alexa just heard you say to her. So, i created a flow in Node Red that as soon as i say Alexa and start talking, she turns on a light. She also sends a blank message in msg.payload.description.summary when she is done and I use that to turn off a light.

I am not saying what I suggested would do exactly what @PatrickD wants to do but hopefully it will get him moving in right direction. I will do some more digging.

1 Like

Hi Ryan,
Thanks, that seems like a very sensible way to interact briefly with Alexa. I’ll give it a try!

1 Like

Thanks Stephen, I’ll definetly look into the palette when I get a chance. It seems like a good way to hold variables if needed.

I've done some more digging and have run into an issue that might not make it the best solution.

In playing around with it, I found that I could set Alexa up to listen for certain phrases then have actions performed in Node Red. Unfortunately, Alexa was also acting on what she heard and it was definitely not what I wanted her to do. So, since it sounds like you are asking her to do things that she is able within a routine, then Ryan's method is probably preferred. If you need to do something Alexa can't but Hubitat/Node Red can, then you might be able to utilize the Alexa Node Pallete I mentioned but it could get tricky.

I wish there was some way that you could trigger Alexa with a HE Rule or with Node Red to wake her up or send her text that she would react to. If there is, I haven't found it. In the Alexa app, there is a way to wake her by pushing a button in the app so UUUUGGGGHHHHH!!!!

You can trigger Alexa routines with sensors now. So, a virtual contact sensor/switch can be trigger bu Hubitat to kick off an Alexa routine.

1 Like

Yup. I am using contact sensors to trigger Alexa routines.

Thanks for the help!
I was able to setup a similar rule to the one i outlined above.
I now have a dedicated alexa routine for affirmative - "Alexa, yes please" which turns on an "affirmative" virtual switch (with default auto-off in 500ms), which i can then use in conditional (if-then) actions. And same thing for a "negative".

in essense it goes something like.

  1. trigger
  2. notification from alexa
  3. inquiry from alexa in the form of yes/no
  4. waits for the "affirmative" or "negative" switch - which is triggered by an alexa routine
  5. if/then/else action

This is kinda nice, so that you can interact a bit more with your voice device.
so far, i've completed;
the garage left open rule as above
a night-time "check list" of closed doors, locks, mode, lights, HSM, with inquiry if I'd like the status changed if something is unlocked, etc..

can't wait to see the possibilities!