I’m trying to create a simple messaging script to use one script for multiple purposes, but getting errors with quite the cryptic error messages - god knows what they mean (okay, some of you probably do).
Script is as follows:
alias: msg_Telegram
sequence:
- alias: "Set variables"
variables:
msg_target: >
{% if {{ target }} == "Laurens" %}
12345
{% elif {{ target }} == "Dymphy" %}
12346
{% else %}
12347
{% endif %}
- choose:
- conditions:
- condition: template
value_template: "{{ photo_url } is defined"
sequence:
- service: telegram_bot.send_photo
data:
target: {{ msg_target }}
caption: "{{ title }}"
file: "{{ photo_url }}"
- conditions:
- condition: template
value_template: "{{ video_url }} is defined"
sequence:
- service: telegram_bot.send_video
data:
caption: "{{ title }}
target: {{ msg_target }}
file: "{{ video_url }}"
default:
- service: telegram_bot.send_message
data:
title: "{{ title }}"
target: {{ msg_target }}
message: "{{ message }}"
mode: single
icon: mdi:message
Resulting error: Message malformed: expected a dictionary for dictionary value @ data[‘sequence’][0][‘variables’]
I’ve checked all indentation, tabs etc. Still doing something wrong?