#Script for_each

1 messages · Page 1 of 1 (latest)

fallen kindle
#

I'm trying to replicate the syntax as documented here:
https://www.home-assistant.io/docs/scripts#for-each

Here is my script:
demo_for_each_loop: mode: restart sequence: - alias: use a for each loop repeat: for_each: - "lounge_lights" - "kitchen_lights" sequence: - service: light.turn_off target: entity_id: "light.{{ repeat.item }}"

But I am getting "Expected object" error on the "lounge_lights" line.

What am I missing? I'm new to these scripts but I've been looking at it for hours and can't see what's wrong. I hope someone else can see it.

idle totem
#

I don't see anything strange here

fallen kindle
#

That's two of us 🙂

idle totem
#

Where are you seeing that error, in the trace?

fallen kindle
idle totem
#

Ah, did you actually test it? I guess this is just a bug in the VSCode HA extension