Amazon Alexa adds custom actions

Works with the Virtual Switch as Motion Sensor driver. Great idea by the way. I will add that to my Pico for when I turn off my bedroom lights.

1 Like

Works for me also. Perhaps @Tim-in-Ca didn't specify the From device? Update: Well sort of. It works when the routine is "played" from the Alexa app. I haven't been able to get it to turn off the screen of the Show being spoken to, or to have it trigger on voice command. But triggering on voice command isn't needed. More testing required.

Weird. Both work for me

1 Like

Thanks. I tweaked and this works for me! No more telling her to turn off the screen!!!

1 Like

What caused your screenshot to show the States of motion, contact and switch? My virtual device only show motion and switch.

Also I've created Alexa routines for when motion is detected via the virtual switch. (Have it turn on an Amazon Plug for example). I'm confused about wanting to turn Off the Plug.... If I say motion is not detected, it looks like I'll have to wait a minute? It didn't work when I left it at 0 minutes. What would be the best way to use the virtual to turn it off?

He's using a virtual device that supports all 3.

https://raw.githubusercontent.com/ogiewon/Hubitat/master/Drivers/virtual-motion-switch.src/virtual-motion-switch.groovy

That code did not define on or off for contact sensors. I modified it and added.

The code used in my screen shot had the contact added just as you did. But you don’t really need contact for this. In fact, I never use it and in the past anyway, motion worked better with Alexa. Response was faster. Might not be the case now, but there’s no point in changing. The result is all that matters, and motion works great.

There are lots of capabilities you could add to a driver. You can find them here if you’re interested.

If you want the switch to stay on, and thus motion remains active to Alexa, remove this line

runIn(3, off)

If you want the switch to turn on and then turn of 1 second later for example, change the line to this...

runIn(1, off)

Brilliant! Thanks for that. I'm using this to add to HE an Amazon Smart switch. Commenting that out, and using '0' delay for the detects no motion on the routine in the Alexa app keeps this in sync.

Thanks!

Today I realized that this feature, in a roundabout way, can solve parts of an old problem. If you google, "Alexa device specific routines", you'll see what I'm talking about. There are two reasons you'd want this:

  1. Make a routine that can only be triggered in a certain room.
  2. Make a routine that does different things depending on which room you're in.

Ok, I don't have a solution for #1. And #2 is partially solved if the only thing you want to do is turn off the lights. You can put the lights and the Alexa in a room group, and say "turn off the lights".

But, and this is the new part, what if you want an alias? What if you want to be able to say "Alexa, good night" and have that turn off the lights in whatever room you're in?

I just tried it out:

  • Make a routine with your new trigger, such as saying "Good night"
  • Instead of having it use the smarthome actions, have it use a custom action of "turn off the lights"
  • Here's the key: in custom actions, you can tell it to run your custom action on the device you just spoke to.

So now if I go into any room and say "Alexa, good night", it will turn off the lights in that room.

It's still pretty much limited to things that already make use of room groups, but it does allow you to define your own way of instructing Alexa.

4 Likes

Yep. All kinds of cool stuff you can now do with these custom actions in their routines, but I do really want the ability to do this without the "OK" response, but not having to turn on Brief Mode. Essentially, I want the full Google Assistant Relay experience (which I have), but for Alexa.

Anyone using Node Red found a way to get to this Custom Actions from Node Red? I use the alexa2-remote pallet and can't find it.

Is this the installation you did?

Yes. I'm still running v1.0 and it works just fine for controlling devices. I don't use the announcements or any other functions that were added in later versions.

Alexa custom actions in routines is now available in the UK. :slight_smile:
Seems to work well. Something I didn't realise is you can stack commands. For instance I have a smarter kettle and I can use a custom action of Alexa, set the kettle temperature to 80 degrees and turn kettle on There are two commands in that sentence. I've had alexa for years and didn't realise you could do that until now.

4 Likes

when I do this with an example "open silk" command, Echo device says "here's silk"
so it is not silent.
How can I make the custom command silently run ?

It used to work with Firefox, but they don’t support it anymore. I don’t think you can do it silently with Silk.

I've created a small Alexa skill for myself.
Now I say "open hubitat dashboard" and my skill shows the dashboards URL from my Hub.
Then it asks if I want to open a specific dashboard.
When I say the name of the dashboard, it opens that specific dashboard.

So I created my first nodejs Alexa skill.
Sometimes, difficulties make you learn new things :slight_smile:

2 Likes