Ajouter christmas_lights.yml

This commit is contained in:
2025-12-21 13:40:31 +00:00
commit bd4b51c13d

114
christmas_lights.yml Normal file
View File

@@ -0,0 +1,114 @@
blueprint:
name: Sequential Christmas Blink Loop
description: >
Turn selected lights on in sequence, then blink them twice, and
keep repeating while an enable helper is ON.
domain: automation
source_url: https://example.com/sequential-christmas-blink-loop
input:
enable_helper:
name: Enable switch
description: Helper (input_boolean) that enables/disables the effect.
selector:
entity:
domain: input_boolean
lights:
name: Lights (sequence order)
description: Select the lights; order here is the sequence order.
selector:
target:
entity:
domain: light
on_delay:
name: Delay between lights turning on (s)
default: 0.5
selector:
number:
min: 0.1
max: 5
step: 0.1
mode: slider
blink_color:
name: Blink color (optional)
description: Leave empty for current color.
default: [255, 0, 0]
selector:
color_rgb: {}
blink_count:
name: Number of blinks after sequence
default: 2
selector:
number:
min: 1
max: 10
step: 1
blink_on_time:
name: Blink ON time (s)
default: 0.4
selector:
number:
min: 0.1
max: 5
step: 0.1
blink_off_time:
name: Blink OFF time (s)
default: 0.4
selector:
number:
min: 0.1
max: 5
step: 0.1
mode: restart
max_exceeded: silent
variables:
enable_helper: !input enable_helper
lights: !input lights
on_delay: !input on_delay
blink_color: !input blink_color
blink_count: !input blink_count
blink_on_time: !input blink_on_time
blink_off_time: !input blink_off_time
trigger:
- platform: state
entity_id: !input enable_helper
to: "on"
condition: []
action:
- repeat:
while:
- condition: state
entity_id: !input enable_helper
state: "on"
sequence:
# 1. Turn lights on in sequence
- variables:
light_list: "{{ expand(lights.entity_id) | map(attribute='entity_id') | list }}"
- repeat:
count: "{{ light_list | length }}"
sequence:
- service: light.turn_on
target:
entity_id: "{{ light_list[repeat.index - 1] }}"
- delay:
seconds: "{{ on_delay | float }}"
# 2. Blink them blink_count times
- repeat:
count: "{{ blink_count }}"
sequence:
- service: light.turn_on
target: !input lights
data:
rgb_color: "{{ blink_color }}"
brightness: 255
- delay:
seconds: "{{ blink_on_time | float }}"
- service: light.turn_off
target: !input lights
- delay:
seconds: "{{ blink_off_time | float }}"