Hello Home Assistant Experts,
I am trying to create a blueprint that takes a set of scripts as an input. When it is triggered and the conditions are met, all scripts shall be executed. I started out with a blueprint that would take a single script as input and call that - this original version of the blueprint worked. I am now facing problems with extending this to inputting and calling multiple scripts. See below for my current (non-working) version of the blueprint and even further below for some context on what I’m actually trying to achieve.
With this version of the blueprint, when trying to create an automation from this blueprint, I get the error message “Message malformed: template value does not contain a dynamic template for dictionary value @ data['action'][0]['repeat']['for_each']
”. I tried googling for the error message and also for more general information on how to do for_each:
on a set of inputs - the results have brought me to what you see before you. I believe that the problem is pretty much the entirety of the action:
section, and that I’m not converting the list of inputs to a dict in the right way - although I have not found any hints as to what the correct way would be.
Can you please let me know how I can configure a number of scripts as inputs and have them all called in a loop from this blueprint?
blueprint:
name: Conditional Shutter Control
description: Based on a time helper and an on/off switch, actuate shutters.
domain: automation
input:
time_helper:
name: Time to fire the automation
selector:
entity:
filter:
domain: input_datetime
enable_helper:
name: Whether the automation should currently be active
selector:
entity:
filter:
domain: input_boolean
the_scripts:
name: The scripts to execute
selector:
entity:
filter:
domain: script
multiple: true
variables:
local_the_scripts: !input the_scripts
trigger:
- platform: time
at: !input time_helper
condition:
- condition: state
entity_id: !input enable_helper
state: "on"
action:
repeat:
for_each: local_the_scripts
sequence:
- service: script
#data: {}
target:
entity_id: repeat.item
mode: single
Additional Context: I have shutters on all windows of my house and want to move them to a “sun protection” position - basically as open as possible without letting direct sunlight into the room. I have figured out the correct opening percentage for every shutter. I then created scripts for each room that have the specific shutter positions for that room. With these scripts, I can manually trigger the shutters to move.
I now want to create automations for every side of the house (south, southwest, west,…) to begin sun protection for all rooms on that side at a certain time, or to open the shutters back up on that side on a certain other time.
I have the overall setup working with lots of cloned automations. However, I want the timings to be adjustable through the Lovelace UI to make adjustments more convenient for me and for other members of the household. Also, I want to be able to easily disable sun protection on cloudy days - which currently means going into automation settings and disabling the existing automation outright. Here, another button in the UI would be really convenient.
I’m not fixed on using scripts - A solution that lists the respective shutters and their individual positions would also be acceptable, provided that I can still trigger the sun protection setting manually, independent of the configured time_helper
.
Any help is appreciated!
Regards
Damian