I’m looking to establish a list of colors in script variables, and then iterating over that to determine the next color my lights will be. However, when the list should be used in the template, it comes in as undefined. I thought variables could be any valid yaml type?
light_on:
description: "activate lights in multiple rooms"
mode: single
variables:
entities:
office:
lights: light.office
colors:
- type: color_temp # cold
color_temp: 153
living:
lights: light.living_room
colors:
- type: color_temp # cold
color_temp: 153
- type: color_temp # warm
color_temp: 454
- type: color # Gold
xy_color:
- 0.496
- 0.473
- type: color # AntiqueWhite
xy_color:
- 0.357
- 0.348
bedroom:
lights: light.bedroom
colors:
- type: color_temp # cold
color_temp: 153
fields:
room_fragment:
description: "fragment of room name to affect"
event:
description: "Hue event id"
sequence:
- service: system_log.write
data:
message: "{{ entities[room_fragment]['lights']['lights'] }}" #< works
- service: system_log.write
data:
message: "{{ entities[room_fragment]['lights']['colors'] }}"
#< Error while executing automation automation.home_light_on: UndefinedError: 'colors' is undefined
Accessing the lights property works fine, but colors is undefined. When I look at entities[room_fragment]
I can see the colors property is there, but I can not access it. Any ideas?
Thanks in advance.