I’m trying to create a script for randomized vacation lighting. I want to collect a list of lights, pick one random, set it to a random dim_level and turn it off after a random period. Keeping the same light within the variable throughout the script.
The "result_template gives me the “Property result_template is not allowed”. Can anyone see anything obvious here?
Blockquote
sequence:
# Select a random light entity
- condition: template
value_template: >
{% set lights = ['light.bedroom_light', 'light.kitchen_light', 'light.living_room_light'] %}
{{ lights | random }}
result_template: "{{ item }}"
# Set a random dim level for the selected light
- service: light.turn_on
data:
entity_id: "{{ result }}"
brightness_pct: "{{ 100 | random }}"
# Set the light to turn off at a random time no shorter than 10 minutes and no longer than 60 minutes
- delay:
minutes: "{{ 10 | random(start=10, end=60) }}"
- service: light.turn_off
data:
entity_id: "{{ result }}"
mode: single