I’m trying to set up a script that takes a list of entities that it will apply an effect on. For some reason, however, when I enter multiple entries, they somehow get wrapped into an additional list, resulting in the parameter being a list of lists.
Can someone help me find out what I’m doing wrong?
Here is the script:
service: light.turn_on
data:
brightness: '{{ (range(100,250)|random)|int }}'
color_temp: '{{ (range(400, 500)|random)|int}}'
transition: '{{ (range(800, 1500)|random)/1000 }}'
target:
area_id: '{{areas|default([])}}'
entity_id: '{{entities|default([])}}'
Here is how I’m calling it:
service: script.1684512264427
data:
areas:
- daniel_s_office
- corridor
And here is the result:
domain: light
service: turn_on
service_data:
brightness: 108
color_temp: 401
transition: 1.213
area_id:
- - daniel_s_office
- corridor
entity_id: []
target:
area_id:
- - daniel_s_office
- corridor
entity_id: []
As you can see, instead of areas
being a list of areas, it somehow turns into a list with a list of areas.