Hi,
I’m trying to make a script/blueprint to send a discord message with multiple images. It works well with a single one, multiple when I do not use inputs, but when it comes to using inputs and multiple, then I receive a discord message without any images inside.
Here is the code:
alias: Discord notification
fields:
title:
description: Notification title
example: Title
required: true
selector:
text: null
message:
description: Notification message
example: Message
required: true
selector:
text: null
color:
description: Notification color
example: green
required: true
selector:
select:
options:
- green
- orange
- red
channel:
description: Discord channel
example: general
required: true
selector:
select:
options:
- general
- security
image:
description: Image filename path
example: /tmp/entity_id.name
required: false
selector:
text:
multiline: true
prefix: /tmp/
multiple: true
sequence:
- service: notify.home_assistant
data:
message: ""
target: |
{% if channel == "security" %}
xxx
{% else %}
yyy
{% endif %}
data:
embed:
description: |
{{ message }} {{ now().strftime('\n\n%d-%m-%Y at %H:%M:%S') }}
url: https://xxx/
author:
name: "{{ title }}"
color: |
{% if color == "red" %}
15548997
{% elif color == "orange" %}
15105570
{% else %}
5763719
{% endif %}
images: |
{% for item in image %}
- {{ item }}
{% endfor %}
icon: mdi:message-badge-outline
mode: queued
max: 100
When I look into traces, I can see:
images: |-
- xxx.jpg
- yyy.jpg
- zzz.jpg
If I try to manually add those images without |-
, it works well:
images:
- xxx.jpg
- yyy.jpg
- zzz.jpg
It looks like a jinja templating issue, any idea how to fix this?
Thanks a lot in advance