I want to write a section of code in YAML (not jinja, because I need to call services) that repeats for each of the items in a blueprint input
The input is
input:
thermostat_controls:
name: DEVICE ENTITY - Thermostat control (mandatory)
description: One or more thermostat entities that are to be controlled by this automation
selector:
entity:
filter:
domain: climate
multiple: true
I referred to the Home Assistant Script Syntax documentation, and am following the examples given.
The current code (fragment) is
variables:
local_thermostat_controls: !input thermostat_controls
action:
- repeat:
for each: "{{ local_thermostat_controls }}"
sequence:
- if:
- condition: template
value_template: "{{ not state_attr(repeat.item, 'temperature') == states(local_required_temperature) }}"
then:
# Send the command
- service: climate.set_temperature
data:
temperature: local_required_temperature
target:
entity_id: repeat.item
I ge the error message
Message malformed: extra keys not allowed @ data['action'][0]['repeat']['for each']
What are the ‘extra keys’??
I have also tried
- repeat:
for each: "{{ local_thermostat_controls | list }}"
and
- repeat:
for each: !input thermostat_controls
… but all versions produce the same result.