Spent some time experimenting with the Template support for Alexa Intents, and came up with the following to activate any scene:
In the Amazon Interaction module add this to the intent schema:
{
"intent": "ActivateSceneIntent",
"slots":[
{
"name" : "Scene",
"type" : "Scenes"
}
Then create a custom slot type called Scenes
listing every scene you want to control:
The names must exactly match the scene names (minus underscores - amazon discards them anyway and we later map them back in with the template).
Add a sample utterance:
ActivateSceneIntent activate {Scene}
Then add the intent to your Alexa Section in your HA config file:
ActivateSceneIntent:
action:
service: scene.turn_on
data_template:
entity_id: scene.{{ Scene | replace(" ", "_") }}
speech:
type: plaintext
text: OK
Then say “Alexa ask homeassistant to activate downstairs on” or any other scene, and bingo! A lot easier than adding an intent for each scene.
As a bonus - tired of Alexa always saying the same boring thing back to you to confirm a command? Try this:
Replace the “OK” with:
text: !include alexa_confirm.yaml
And create a file called alexa_confirm.yaml
with something like the following in it (go on, be creative!):
>
{{ [
"OK",
"Sure",
"If you insist",
"Done",
"No worries",
"I can do that",
"Leave it to me",
"Consider it done",
"As you wish",
"By your command",
"Affirmative",
"Yes oh revered one",
"I will",
"As you decree, so shall it be",
"No Problem"
] | random }}
```
Alexa will respond with a random phrase each time. You can use the include for as many different intents as you like!
Have fun :)