H2 execute a script via Alexa

I am running hass.io with Nabu Casa which works very well. I created a few scripts which I would like to execute via Alexa. What would be the right syntax to call up a script via Alexa?

1 Like

Does this answer your question?

Well, the setup with Alexa is through Nabu Casa which is really super easy and most devices work fine. Now I just have to figure out how to voice activate scripts.

Is that not what is described in the page I referred you to?

Alexa cloud treats scripts as scenes. Therefore the simplest way is to say Alexa turn on “script name”. Sometimes that works well enough depending on the script name and what it does. If it doesn’t achieve what you want you can use the routines in the Alexa app to customize your phrase and response.

For example I have a script that turns off everything on my whole ground floor. To activate it natively via Alexa I would have to say “Alexa turn on everything downstairs off” which is odd. Using the routine function I can change it to anything I want. I just need to remember the exact phrase. Currently “turn off everything downstairs” just make sure the actual script name and phrase aren’t too similar

There are some other work around abut that’s the quickest

1 Like

have a look at this I use dummy bulbs to trigger events

1 Like

Hmm @nickrout, that looks quite complicated. I was hoping that NabuCasa would take the complexity out of it - just like it works with devices. :confused:

Thanks @lonebaggie, looks like something to study!

For example I have a script that turns off everything on my whole ground floor. To activate it natively via Alexa I would have to say “Alexa turn on everything downstairs off” which is odd. Using the routine function I can change it to anything I want. I just need to remember the exact phrase. Currently “turn off everything downstairs” just make sure the actual script name and phrase aren’t too similar

This would actually be ideal. However, Scripts do not show up in my Alexa devices. Automations do, interestingly enough, but not Scripts. Any idea how I can get them to show?

Ah, just found them in “various settings”. However, there doesn’t seem to be a way to create a routine with scenes. Am I missing something here?

Success! It’s not by looking for routines under scenes but for scenes under routines that I found it. Silly me!

So to recap for whoever is looking to do the same thing: get Nabu Casa, create your scripts on HA, go to routines on the Alexa app on your phone and just add a routine and the associated key phrase.

Simple as 1-2-3. :sunglasses:

2 Likes

Glad you got it working. :slight_smile:

If you plan on adding a number of routines , you may be better off creating a dummy bulb, exposing the bulb to alexa. This will save adding a large number of devices ( HA scripts, input boolean, etc ) to alexa .
You can then create a single automation in HA that can trigger the scripts or anything else in HA using the brightness level of the dummy bulb. This will ensure you only have the devices you need in alexa and you can add and delete scripts on the fly without having to rediscover all the time .

I went from 86 devices in alexa to 35 , as I was using scripts and input boolean to trigger HA from alexa

1 Like

Good idea, thanks!

@lonebaggie: What is actually the best way to create a dummy switch in connection with Alexa? Anything in particular to observe?

THis will create a bulb in HA which does nothing . Alexa should be able to discover the bulb and you can then add the bulb to your routines in the alexa app. You change the brightness to a different level in each alexa routine . Then create a HA automation that triggers when the dummy bulb is turned on . Then test for the brightness level and trigger whatever you need. One bulb in alexa 99 triggers for HA. Remember to turn the bulb off once you trigger the action in your automation

This how I trigger the Speech parser. All my examples are in Python via Appdaemon. I don’t use HA automations scripts, but I will help where I can :slight_smile: .

1 Like

Thank you so much for this!

Another helpful tip for those out there: Under “Alexa Will” select 'Smart Home’s and then ‘Scenes’ and you should see your script.