Hello,
I have this in a script:
action: notify.mobile
data:
title: "{{ title }}"
message: "{{ message }}"
data:
tag: "{{ tag }}"
car_ui: "{{ car_ui }}"
notification_icon: "{{ icon }}"
actions:
- action: "{{ action }}"
title: "{{ action_title }}"
uri: "{{ action_uri }}"
If I don’t have the action variables defined then I get a warning in the logs.
I was thinking of doing something like this:
action: notify.mobile
data:
title: "{{ title }}"
message: "{{ message }}"
data:
tag: "{{ tag }}"
car_ui: "{{ car_ui }}"
notification_icon: "{{ icon }}"
{% if action defined %}
actions:
- action: "{{ action }}"
title: "{{ action_title }}"
uri: "{{ action_uri }}"
{% endif %}
but then find out that doesn’t work.
Error:
Message malformed: template value should be a string dictionary value @ data[‘sequence’][0][‘data’]
I was thinking I’d use an if-then block for checking {{ action is defined }}, but I was hoping there might be a cleaner way of doing it. Then, if I need to modify the notify action then I’d only have to change it once.
I hope that all makes sense.
Thanks!