-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.yaml
600 lines (600 loc) · 16.2 KB
/
scripts.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
kitchen_cabinet_light_based_on_entity_state:
alias: Kitchen Cabinet Light Based On Entity State
mode: queued
max: 10
icon: mdi:file-cabinet
sequence:
- service: scene.create
data:
scene_id: kitchen_cabinet_light_based_on_entity_state_kitchen_cabinet_backup
snapshot_entities:
- light.kitchen_cabinet_light
- service: light.turn_on
data:
rgb_color: "{% if states(entity_id) == 'off' -%}\n [50, 200, 0]\n{% else -%}\n
\ [200, 50, 0]\n{% endif %}"
brightness: 150
transition: 1
target:
entity_id: light.kitchen_cabinet_light
- delay: 00:00:01
- service: scene.turn_on
target:
entity_id: scene.kitchen_cabinet_light_based_on_entity_state_kitchen_cabinet_backup
data: {}
office_on_off:
alias: Office On Off
mode: single
icon: mdi:office-building
sequence:
- if:
- condition: and
conditions:
- condition: state
entity_id: light.office_lights
state: 'off'
- condition: state
entity_id: switch.desk_switch
state: 'off'
then:
- service: light.turn_on
target:
entity_id: light.office_lights
- service: switch.turn_on
target:
entity_id: switch.desk_switch
else:
- service: light.turn_off
data:
transition: 10
target:
entity_id: light.office_lights
- service: switch.turn_off
target:
entity_id: switch.desk_switch
shutters_up_sun:
alias: Shutters Up Sun
mode: single
icon: hass:window-open
sequence:
- condition: state
entity_id: binary_sensor.shutter_operation_to_cold_or_windy
state: 'off'
- if:
- condition: state
entity_id: binary_sensor.office_window_sensor
state: 'off'
then:
- service: cover.open_cover
target:
area_id: office
- if:
- condition: state
entity_id: binary_sensor.parlor_window_sensor
state: 'off'
then:
- service: cover.open_cover
target:
area_id: parlor
- if:
- condition: state
entity_id: binary_sensor.lower_kitchen_window_sensor
state: 'off'
then:
- service: cover.open_cover
target:
entity_id: cover.lower_kitchen_roller_shutter_left_level
- if:
- condition: state
entity_id: binary_sensor.upstairs_window_sensor
state: 'off'
then:
- service: cover.open_cover
target:
area_id: upstairs
night_light:
alias: Home Light
fields:
scene_color:
name: Scene Color
description: ''
required: true
selector:
select:
options:
- label: Purple
value: purple
- label: Night
value: night
- label: Green
value: green
- label: Blue
value: blue
- label: Red
value: red
- label: White
value: white
default: white
sequence:
- parallel:
- service: automation.turn_off
data:
stop_actions: true
target:
entity_id:
- automation.office_ceiling_lights_backup_kitchen_cabinet_state
- automation.floor_motion
- automation.bedroom_motion
- automation.bathroom_motion
- automation.floor_helper_motion
- service: input_boolean.turn_on
target:
entity_id:
- input_boolean.floor_light_active
- input_boolean.floor_helper_light_active
- input_boolean.bathroom_light_active
enabled: true
data: {}
- service: scene.turn_on
target:
entity_id:
- scene.floor_front_night
- scene.office_desk_{{ scene_color }}
- scene.kitchen_cabinet_{{ scene_color }}
- scene.bathroom_lamp_{{ scene_color }}
- service: light.turn_on
target:
entity_id: light.panel_mirror_switch
data: {}
- service: script.turn_on
target:
entity_id: script.scene_on
data:
variables:
scene: scene.bedroom_bed_{{ scene_color }}
light:
- light.bedroom_bed_light
- if:
- condition: state
entity_id: switch.bedroom_shutter_down_relay
state: 'off'
then:
- service: scene.turn_on
target:
entity_id:
- scene.terrace_plants_spots_{{ scene_color }}
- service: light.turn_off
target:
entity_id:
- light.floor_middle_light
- light.floor_back_light
- light.office_ceiling_lights
- light.kitchen_cabinet_switch
- light.bedroom_nightstand_lights
data: {}
- wait_for_trigger:
- platform: state
entity_id:
- light.office_ceiling_lights
to: 'off'
from: 'on'
for:
hours: 0
minutes: 0
seconds: 1
timeout:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: automation.turn_on
data: {}
target:
entity_id:
- automation.office_ceiling_lights_backup_kitchen_cabinet_state
- automation.floor_motion
- automation.bedroom_motion
- automation.bathroom_motion
- automation.floor_helper_motion
mode: single
icon: mdi:lightbulb-night
scene_on:
alias: Scene On
fields:
scene:
name: Scene Entity
description: Scene to turn on
required: true
selector:
entity:
domain: scene
light:
name: Light Entity
required: false
selector:
entity:
domain: light
multiple: true
mode: queued
max: 10
icon: mdi:light-flood-down
sequence:
- service: light.turn_off
target:
entity_id: "{{ \n light | \n default(scene | \n regex_replace(find='^scene',
replace='light') | \n regex_replace(find='[a-z]+$', replace='light')\n
\ ) \n}}"
data: {}
- service: scene.turn_on
target:
entity_id: '{{ scene }}'
shutter_horizontal_open:
alias: Shutter Horizontal Open
fields:
area:
name: Area name
description: Close shutter but open them horizontally at the end (parlor/bedroom)
required: true
selector:
area:
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.{{ area }}_shutter_down_relay
- delay:
hours: 0
minutes: 0
seconds: '{{ states(''input_number.'' + area + ''_shutter_horizontal_open_delay'')
| int(0) }}'
milliseconds: 0
- wait_template: '{{ states(''sensor.'' + area + ''_shutter_down_energy_power'')
| float(0) < 2.0 }}'
continue_on_timeout: false
timeout: 00:01:30
enabled: false
- service: switch.turn_on
data: {}
target:
entity_id: switch.{{ area }}_shutter_up_relay
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 100
- service: switch.turn_off
data: {}
target:
entity_id: switch.{{ area }}_shutter_up_relay
mode: single
icon: mdi:blinds-horizontal
bedroom_bed_light_helper:
alias: Bedroom Bed Light Helper
fields:
action:
name: Action Type
description: ''
required: true
selector:
select:
options:
- label: Toggle
value: toggle
- label: Scene
value: scene
- label: Turn On
value: turn_on
scene:
name: Scene Entity
description: Scene to turn on
example: "service: script.bedroom_bed_light_helper\ndata:\n action: scene\n
\ scene: scene.bedroom_bed_green\n"
required: false
selector:
entity:
domain: scene
sequence:
- if:
- condition: or
conditions:
- condition: and
conditions:
- condition: or
conditions:
- condition: state
entity_id: light.bedroom_bed_light
state: 'off'
- condition: numeric_state
entity_id: automation.bedroom_motion
attribute: current
above: 0
- condition: state
entity_id: input_boolean.bedroom_bed_light_active
state: 'off'
- condition: template
value_template: '{{ action == ''scene'' or action == ''turn_on'' }}'
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.bedroom_bed_light_active
- choose:
- conditions:
- condition: template
value_template: '{{ action == ''toggle'' or action == ''turn_on'' }}'
sequence:
- service: script.turn_on
target:
entity_id: script.scene_on
data:
variables:
scene: scene.bedroom_bed_white
- conditions:
- condition: template
value_template: "{% if not scene|default('') and action == 'scene' -%} \n
\ true \n{%- else -%} \n false \n{%- endif -%} \n"
sequence:
- service: input_select.select_next
data:
cycle: true
target:
entity_id: input_select.bedroom_bed_scenes
- service: script.turn_on
target:
entity_id: script.scene_on
data:
variables:
scene: '{{ states(''input_select.bedroom_bed_scenes'') }}'
- conditions:
- condition: template
value_template: "{% if scene|default('') and action == 'scene' -%} \n true
\n{%- else -%} \n false \n{%- endif -%} \n"
sequence:
- service: script.turn_on
target:
entity_id: script.scene_on
data:
variables:
scene: '{{ scene }}'
default:
- stop: Wrong usage or wrong/missing condition
error: true
else:
- service: light.turn_off
data: {}
target:
entity_id: light.bedroom_bed_light
mode: queued
icon: mdi:bed-double
max: 5
bathroom_light_helper:
alias: Bathroom Light Helper
sequence:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.bathroom_light_active
- choose:
- conditions:
- condition: template
value_template: "{% if light|default([]) and action == 'call-service' and
service|default('') -%} \n true \n{%- else -%} \n false \n{%- endif -%}
\n"
sequence:
- service: '{{ service }}'
data: "{% if service == 'light.turn_off' -%}\n {}\n{%- else -%}\n {\n 'brightness':
{{ states('sensor.daytime_light_brightness') }},\n 'color_temp': {{ states('sensor.daytime_light_color_temp')
}}\n }\n{%- endif -%}"
target:
entity_id: '{{ light }}'
- conditions:
- condition: template
value_template: "{% if not scene|default('') and action == 'scene' -%} \n
\ true \n{%- else -%} \n false \n{%- endif -%} \n"
sequence:
- service: input_select.select_next
data:
cycle: true
target:
entity_id: input_select.bathroom_lamp_scenes
- service: scene.turn_on
data: {}
target:
entity_id: '{{ states(''input_select.bathroom_lamp_scenes'') }}'
- conditions:
- condition: template
value_template: "{% if scene|default('') and action == 'scene' -%} \n true
\n{%- else -%} \n false \n{%- endif -%} \n"
sequence:
- service: scene.turn_on
target:
entity_id: '{{ scene }}'
default:
- stop: Wrong usage or wrong/missing condition
error: true
fields:
action:
name: Action Type
description: call-service/scene
required: true
selector:
select:
options:
- label: Call-Service
value: call-service
- label: Scene
value: scene
service:
name: The service to call, if 'action' is 'call-service'.
description: Turn on/off/toggle lights
example: "service: script.bathroom_light_helper\ndata:\n action: call-service\n
\ service: light.turn_on\n light:\n - light.bathroom_lights\n"
required: false
selector:
select:
options:
- label: Light Turn On
value: light.turn_on
- label: Light Turn Off
value: light.turn_off
- label: Light Toggle
value: light.toggle
scene:
name: Scene Entity
description: Scene to turn on. If empty, cycle if 'action' is 'scene'.
example: "service: script.bathroom_light_helper\ndata:\n action: scene\n scene:
scene.bathroom_lamp_green\n"
required: false
selector:
entity:
domain: scene
light:
name: Light Entity To Toggle
description: List of light entities. Ignored if 'action' is 'scene'
example: "service: script.bathroom_light_helper\ndata:\n action: toggle\n light:\n
\ - light.bathroom_lights\n"
required: false
selector:
entity:
domain: light
multiple: true
mode: queued
icon: mdi:bathtub
max: 5
daytime_night:
alias: Daytime Night
sequence:
- if:
- condition: state
entity_id: input_boolean.daytime_night_running
state: 'off'
then:
- service: input_boolean.turn_on
target:
entity_id: input_boolean.daytime_night_running
data: {}
- service: scene.create
data:
scene_id: daytime_night_running_{{ light | replace('light.', '') }}_backup
snapshot_entities:
- '{{ light }}'
- repeat:
count: '4'
sequence:
- service: light.turn_on
data:
rgb_color:
- 200
- 50
- 0
brightness: 150
transition: 1
target:
entity_id: '{{ light }}'
- delay: 00:00:02
- service: light.turn_on
data:
rgb_color:
- 200
- 50
- 0
brightness: 20
transition: 1
target:
entity_id: '{{ light }}'
- delay: 00:00:02
- service: input_select.select_option
data:
option: Night
target:
entity_id: input_select.daytime
- service: input_boolean.turn_off
target:
entity_id: input_boolean.daytime_night_running
data: {}
else:
- service: input_boolean.turn_off
target:
entity_id: input_boolean.daytime_night_running
data: {}
- service: scene.turn_on
target:
entity_id: scene.daytime_night_running_{{ light | replace('light.', '') }}_backup
data: {}
mode: restart
icon: mdi:sleep
fields:
light:
name: Light Entity
description: The light entity to use as an indicator.
example: "service: script.daytimes_night\ndata:\n light:\n - light.bedroom_bed_light\n"
required: true
selector:
entity:
domain: light
shutter_sunny_down:
alias: Shutter Sunny Down
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.{{ area }}_shutter_down_relay
- delay:
hours: 0
minutes: 0
seconds: '{{ (states(''input_number.'' + area + ''_shutter_horizontal_open_delay'')
| int(0) / 32) * 23}}'
milliseconds: 0
- wait_template: '{{ states(''sensor.'' + area + ''_shutter_down_energy_power'')
| float(0) < 2.0 }}'
continue_on_timeout: false
timeout: 00:01:30
enabled: false
- service: switch.turn_on
data: {}
target:
entity_id: switch.{{ area }}_shutter_up_relay
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 50
- service: switch.turn_off
data: {}
target:
entity_id: switch.{{ area }}_shutter_up_relay
fields:
area:
name: Area name
description: Close shutter but open them horizontally at the end (parlor/bedroom)
required: true
selector:
area:
mode: single
icon: mdi:weather-sunny
keep_shutters_closed:
alias: Keep Shutters Closed
sequence:
- if:
- condition: state
entity_id: automation.keep_shutters_closed
state: 'on'
then:
- service: automation.turn_off
data:
stop_actions: true
target:
entity_id: automation.keep_shutters_closed
else:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.parlor_shutter_down_relay
- switch.bedroom_shutter_down_relay
- service: automation.turn_on
data: {}
target:
entity_id: automation.keep_shutters_closed
mode: single
icon: mdi:window-shutter-alert