Hi,
I’m trying to put a script together but something is wrong in my formatting that I can’t find. this is the error:
“Failed to perform the action script/vestaboard_message_with_options. expected a dictionary @ data[‘vbml’][‘components’][0]”
I can’t figure out why the components block isn’t showing as a dictionary. I know it has something to do with my templating, but I don’t know why.
Thanks
sequence:
- variables:
alert_color: |-
{% set mappings = {
'none':'{0}',
'red':'{63}',
'blue':'{67}',
'green':'{66}',
'yellow':'{65}',
'orange':'{64}',
'violet':'{68}',
'white':'{69}'
} %} "{{ mappings.get(alert, '{63}') }}"
enabled: true
- action: vestaboard.message
metadata: {}
data:
device_id:
- id1231231
vbml:
props:
text: "{{ words }}"
alert_color: "{{ alert_color }}"
date: "{{ as_timestamp(now())|timestamp_custom('%d') }}"
month: "{{ as_timestamp(now())|timestamp_custom('%b') }}"
hours: "{{ as_timestamp(now())|timestamp_custom('%H') }}"
day: "{{ as_timestamp(now())|timestamp_custom('%A') }}"
minutes: "{{ as_timestamp(now())|timestamp_custom('%M') }}"
temp: "{{ state_attr('weather.openweather','temperature') | int}}"
temp_color: >-
{% if state_attr('weather.openweather','temperature') | float <= 32
%}
{69}
{% elif state_attr('weather.openweather','temperature') | float <=
55 %}
{67}
{% elif state_attr('weather.openweather','temperature') | float <=
75 %}
{66}
{% elif state_attr('weather.openweather','temperature') | float <=
90 %}
{65}
{% else %}
{63}
{% endif %}
components: |-
{% if alert != 'none' %}
- style:
justify: center
align: center
width: 22
height: 5
template: "{{ alert_color * 22 }}"
- style:
justify: center
align: center
width: 1
height: "{{ '3' if status_bar else '4' }}"
template: "{{ (alert_color * 3) if status_bar else (alert_color * 4) }}"
{% endif %}
- style:
justify: center
align: center
width: "{{ '20' if alert != 'none' else '22' }}"
height: >-
{% if alert != 'none' and status_bar %}
3
{% elif status_bar %}
5
{% elif alert != 'none' %}
4
{% else %}
6
{% endif %}
template: "{{ '{{text}}' }}"
{% if alert != 'none' %}
- style:
justify: center
align: center
width: 1
height: "{{ '3' if status_bar else '4' }}"
template: "{{ (alert_color * 3) if status_bar else (alert_color * 4) }}"
- style:
justify: center
align: center
width: 22
height: 5
template: "{{ alert_color * 22 }}"
{% endif %}
{% if status_bar %}
- style:
justify: left
align: center
width: 5
height: 1
template: "{{ '{{date}}{{month}}' }}"
- style:
justify: center
align: center
width: 12
height: 1
template: "{{ '{{day}}' }}"
- style:
justify: right
align: center
width: 5
height: 1
template: "{{ '{{temp}}{62}{{temp_color}}' }}"
{% endif %}
fields:
words:
selector:
text: null
description: The text to display on the Vestaboard
required: true
status_bar:
selector:
boolean: {}
description: Show the Date, Day, and temp status bar at the bottom
default: false
alert:
selector:
select:
options:
- none
- red
- blue
- green
- yellow
- orange
- violet
- white
default: none
alias: Vestaboard - Message with Options
description: >-
Lets to send a basic message, with the option to add an alert frame, and a
status bar.