Hi everyone,
it’s my first time trying to use variables in an automation. It’s built up as follows:
- id: medication_reminder
alias: medication reminder
max_exceeded: silent
variables:
name: Janedoe
trigger:
…
action:
- service: notify.alexa_media
data:
message: "{{name}}"
target: media_player.this_device
data:
type: push
…
The above code is working flawless. But if I use
message: |
{{ [
"{{name}} time for your medicine!",
"Do not forget your medicine {{name}}?",
"…"
]|random }}
I get the error „Template variable warning: 'name' is undefined when rendering 'Do not forget your medicine {{name}}'“
Using {{name|default}}
is cleaning up that. Which is a little bit… long-winded.
Is there a possibility to make it better?