I already read few topics related with Alexa random responses, but I’m really not good with jinja’ing, so I decided to make my own topic for certain question.
I have Alexa custom skill which is working correctly.
This is my intent_script.yaml :
SetEffect: # Intent type
speech:
text: If you insist, the {{ effect }} effect has been applied to {{ entity }}
action:
service: light.turn_on
data:
entity_id: "{{ entity | string }}"
effect: "{{ effect | string }}"
Let’s say that we have utterance “Alexa, ask home lights to apply Rainbow effect to bedside lamp”
In this case:
- “home lights” is skill name
- “Rainbow” is {{ effect }} variable (slot)
- “bedside lamp” is {{ entity }} variable (slot)
As said before, this is working perfectly - rainbow (or some other) effect will be applied to bedside lamp (or some other light) and Alexa will give proper response with proper effect/light entity variable.
I want to put this on higher level and I looked into this. Of course, below code will not work because of {{ }} within {{ }}, and I am not good at all with jinja templating:
SetEffect: # Intent type
speech:
text: >
{{[
"If you insist, the {{ effect }} effect has been applied to {{ entity }}",
"{{ effect }} effect has been applied to {{ entity }}, do you want me to sing you something"
]|random}}
action:
service: light.turn_on
data:
entity_id: "{{ entity | string }}"
effect: "{{ effect | string }}"
Could someone help me with this, thanks?