forked from myGithub-Markus/home-assistant_blueprints
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflashing_lights.yaml
66 lines (61 loc) · 1.65 KB
/
flashing_lights.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
blueprint:
name: flashing lights
description: >
Flashing lights via on off and delay and finally restore the previous light states.
domain: automation
source_url: https://github.com/myGithub-Markus/home-assistant_blueprints/blob/main/flashing_lights.yaml
input:
activated:
name: Activated
description: "Toggle to activate or deactivate flashing lights."
selector:
entity:
target_lights:
name: Lights
description: "To flashing lights"
selector:
target:
entity:
domain: light
delay:
name: (OPTIONAL) Delay
description: "Delay flashing lights"
default: 1000
selector:
number:
min: 0
max: 20000
unit_of_measurement: milliseconds
mode: restart
max_exceeded: silent
trigger:
- platform: state
entity_id: !input activated
to: 'on'
variables:
activated: !input activated
delay: !input delay
target_lights: !input target_lights
condition: []
action:
- service: scene.create
data:
scene_id: all_lights_snapshot
snapshot_entities: >
{% set lights = states.light
| map(attribute='entity_id') | join(',') %}
{{lights}}
- service: light.turn_on
target: !input target_lights
- repeat:
while:
- condition: template
value_template: "{{ activated == none or is_state(activated, 'on') }}"
sequence:
- delay:
milliseconds: "{{ delay }}"
- service: light.toggle
target: !input target_lights
- service: scene.turn_on
data:
entity_id: scene.all_lights_snapshot