-
Notifications
You must be signed in to change notification settings - Fork 1
/
automations.yaml
785 lines (785 loc) · 21.6 KB
/
automations.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
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
- id: '1603830298349'
alias: Walk in closet
description: 'When the door of the walk-in closet is opened, put the light on. Put
it off when the door is closed. When the door is opened for ten minutes, it is
presumably forgotten. In that case, the lights are turned off. '
trigger:
- platform: state
entity_id: binary_sensor.walk_in_closet_on_off
- platform: state
entity_id: binary_sensor.walk_in_closet_on_off
for: 00:10:00
to: 'on'
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.walk_in_closet_on_off
state: 'off'
sequence:
- service: light.turn_off
data: {}
entity_id:
- light.walk_in_closet_1
- light.walk_in_closet_2
default:
- service: light.turn_on
data: {}
entity_id:
- light.walk_in_closet_1
- light.walk_in_closet_2
mode: single
- id: '1603830622083'
alias: Hall and corridor
description: Triggers when there is movement in the hall at ground level or first
floor. When it freezes, warn with a blue light. Brightness is adapted to the desired
level. Because the IKEA sensor at the corridor is slow in going to the cleared
state, have a 10m wait before the Philips sensor at the hall is allowed to clear.
trigger:
- platform: state
entity_id:
- binary_sensor.hall_on_off
- binary_sensor.corridor_on_off
- platform: state
entity_id: binary_sensor.hall_on_off
for: 00:10:00
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.hall_on_off
state: 'off'
for: 00:10:00
- condition: state
entity_id: binary_sensor.corridor_on_off
state: 'off'
sequence:
- service: light.turn_off
entity_id:
- light.hall
- light.corridor
- conditions:
- condition: numeric_state
entity_id: sensor.hall_illuminance
below: 20
sequence:
- choose:
- conditions:
- condition: state
entity_id: input_boolean.bright
state: 'on'
sequence:
- service: light.turn_on
entity_id:
- light.hall
- light.corridor
data:
brightness_pct: 100
color_temp: 380
default:
- service: light.turn_on
entity_id:
- light.corridor
- light.hall
data:
brightness_pct: 50
color_temp: 454
default:
- service: light.turn_off
entity_id:
- light.corridor
- light.hall
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.outside_temperature
below: '0'
- condition: state
entity_id: light.hall
state: 'on'
sequence:
- service: light.turn_on
entity_id: light.hall
data:
color_temp: 153
mode: queued
max: 5
- id: '1603831020194'
alias: Kitchen
description: Triggers when there is movement in the kitchen. Only activate light
when there is less than 20 lux measured in the hall at ground level. Brightness
is adapted to the desired level.
trigger:
- platform: state
entity_id: binary_sensor.kitchen_on_off
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.hall_illuminance
below: '20'
- condition: state
entity_id: binary_sensor.kitchen_on_off
state: 'on'
sequence:
- service: light.turn_on
data:
brightness_pct: '{{ 100 if is_state(''input_boolean.bright'', ''on'') else
50 }}'
target:
entity_id: light.kitchen
default:
- service: light.turn_off
entity_id: light.kitchen
mode: single
- id: '1605426186449'
alias: Attic motion
description: Put the light at the second floor on when there is movement in the
hallway at ground level or first floor. Do so only if there is insufficient light.
trigger:
- platform: state
entity_id:
- binary_sensor.hall_on_off
- binary_sensor.corridor_on_off
- platform: state
entity_id: binary_sensor.hall_on_off
to: 'off'
for: 00:10:00
- platform: time_pattern
minutes: '0'
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.hall_on_off
state: 'off'
for: 00:10:00
- condition: state
entity_id: binary_sensor.corridor_on_off
state: 'off'
sequence:
- service: light.turn_off
entity_id: light.attic
- conditions:
- condition: numeric_state
entity_id: sensor.hall_illuminance
below: '20'
sequence:
- service: light.turn_on
entity_id: light.attic
default:
- service: light.turn_off
entity_id: light.attic
mode: queued
max: 5
- id: '1608134139962'
alias: Shed
description: Put the light in the shed on when the door is opened and it is dark.
Put it off when the door is closed for longer than two minutes. If the door is
closed, the user is reminded of this automation by a brief flash.
trigger:
- platform: state
entity_id: binary_sensor.shed_on_off
- platform: state
entity_id: binary_sensor.shed_on_off
for: 00:02:00
to: 'off'
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.hall_illuminance
below: '20'
- condition: state
entity_id: binary_sensor.shed_on_off
state: 'on'
sequence:
- service: light.turn_on
data: {}
entity_id: light.shed
- conditions:
- condition: state
entity_id: binary_sensor.shed_on_off
state: 'off'
for: 00:02:00
sequence:
- service: light.turn_off
data: {}
entity_id: light.shed
- conditions:
- condition: state
entity_id: binary_sensor.shed_on_off
state: 'off'
sequence:
- service: light.turn_on
data:
flash: short
entity_id: light.shed
default: []
mode: single
- id: '1609859784666'
alias: Sleeping room notification
description: Remind to ventilate the sleeping room when there is a high probability
on mold.
trigger:
- platform: time
at: '12:00:00'
condition:
- condition: numeric_state
entity_id: sensor.bedroom_mold
above: '80'
action:
- service: notify.mobile_app_nokia_7_2
data:
message: 'Sleeping room should be ventilated, predicted probability on mold:
{{states.sensor.bedroom_mold.state_with_unit}}.'
data:
clickAction: /lovelace/thermometer
tag: bedroom
apns_headers:
apns-collapse-id: bedroom
mode: single
- id: '1609974870568'
alias: Doorbell
description: Flash lights and notify when the doorbell is detected by the RTL_433
extension.
trigger:
- platform: device
domain: mqtt
device_id: e26414fa8b56045c92691e2bb4882dda
type: button_short_press
subtype: button
discovery_id: Doorbell
condition: []
action:
- service: notify.everyone
data:
title: Doorbell
message: Doorbell was pressed!
- service: light.turn_on
entity_id: light.hall
- repeat:
count: '4'
sequence:
- service: light.toggle
entity_id:
- light.kitchen
- light.corridor
- light.attic
- light.bedroom_2
- delay: '.5'
- service: light.toggle
entity_id:
- light.kitchen
- light.corridor
- light.attic
- light.bedroom_2
- delay: '1'
mode: single
- id: '1610012660685'
alias: Back-up log
description: Store log just before Home Assistant is rebooted.
trigger:
- platform: homeassistant
event: shutdown
condition: []
action:
- service: shell_command.backup_logs
data: {}
mode: single
- id: '1610482084579'
alias: Shed temperature notification
description: When it becomes too warm in the shed, notify that the beer should be
moved to the fridge!
trigger:
- platform: numeric_state
entity_id: sensor.shed_temperature
above: '10'
condition: []
action:
- service: notify.mobile_app_nokia_7_2
data:
message: The shed is {{states.sensor.shed_temperature.state_with_unit}}.
data:
clickAction: /lovelace/thermometer
tag: shed
apns_headers:
apns-collapse-id: shed
mode: single
- id: '1612890416638'
alias: Sleeping room
description: Handle one IKEA five-button remote (https://www.ikea.com/nl/nl/p/tradfri-afstandsbediening-30443124/)
and two buttons (https://www.ikea.com/ca/en/p/tradfri-wireless-dimmer-white-10408598/).
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: ef6cce96c0aff37b73773be4f1a30e2f
- platform: event
event_type: zha_event
event_data:
device_id: 5a9933c449a2a8068f6012de36a6e91d
- platform: event
event_type: zha_event
event_data:
device_id: b0027c50d2f7ecc24c83a1a47819c346
condition: []
action:
- variables:
device_id: '{{ trigger.event.data.device_id }}'
command: '{{ trigger.event.data.command }}'
cluster_id: '{{ trigger.event.data.cluster_id }}'
endpoint_id: '{{ trigger.event.data.endpoint_id }}'
args: '{{ trigger.event.data.args }}'
ikea_remote: '{{ ''5a9933c449a2a8068f6012de36a6e91d'' }}'
ikea_button_gj: '{{ ''ef6cce96c0aff37b73773be4f1a30e2f'' }}'
ikea_button_m: '{{ ''b0027c50d2f7ecc24c83a1a47819c346'' }}'
- choose:
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''toggle'' }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- service: light.toggle
entity_id: light.bedroom
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''step_with_on_off'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [0, 43, 5] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
brightness_step_pct: 20
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''move_with_on_off'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [0, 84] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
brightness_pct: 100
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''step'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [1, 43, 5] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
brightness_step_pct: -20
- conditions:
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- condition: or
conditions:
- condition: and
conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''move'' }}'
- '{{ args == [1, 84] }}'
- condition: and
conditions:
- '{{ device_id == ikea_button_gj }}'
- '{{ command == ''move_with_on_off'' }}'
- '{{ args == [0, 83] }}'
- condition: and
conditions:
- '{{ device_id == ikea_button_m }}'
- '{{ command == ''move_with_on_off'' }}'
- '{{ args == [0, 83] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
brightness_pct: 1
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [257, 13, 0] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
color_temp: '"{{ state_attr(''light.bedroom_3'', ''color_temp'') - 100}}"'
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3329, 0] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
color_temp: 254
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''press'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [256, 13, 0] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
color_temp: '"{{ state_attr(''light.bedroom_3'', ''color_temp'') + 100 }}"'
- conditions:
- '{{ device_id == ikea_remote }}'
- '{{ command == ''hold'' }}'
- '{{ cluster_id == 5 }}'
- '{{ endpoint_id == 1 }}'
- '{{ args == [3328, 0] }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom
data:
color_temp: 454
- conditions:
- condition: or
conditions:
- '{{ device_id == ikea_button_gj }}'
- '{{ device_id == ikea_button_m }}'
- '{{ command == ''move'' }}'
- '{{ cluster_id == 8 }}'
- '{{ endpoint_id == 1 }}'
- '{{args == [1, 83] }}'
sequence:
- service: light.turn_off
entity_id: light.bedroom
- conditions:
- '{{ device_id == ikea_button_gj }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- choose:
- conditions:
- '{{ command == ''on'' }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom_1
default:
- service: light.turn_off
entity_id: light.bedroom_1
- conditions:
- '{{ device_id == ikea_button_m }}'
- '{{ cluster_id == 6 }}'
- '{{ endpoint_id == 1 }}'
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ command == ''on'' }}'
sequence:
- service: light.turn_on
entity_id: light.bedroom_5
default:
- service: light.turn_off
entity_id: light.bedroom_5
mode: queued
max: 25
- id: '1612988672846'
alias: Toilet
description: Switch the toilet light when the door is opened.
trigger:
- platform: state
entity_id: binary_sensor.toilet_on_off
- platform: state
entity_id: binary_sensor.toilet_on_off
for: 00:05:00
- platform: time_pattern
minutes: '0'
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.toilet_on_off
state: 'off'
for: 00:05:00
sequence:
- service: switch.turn_off
entity_id: switch.toilet
- conditions:
- condition: state
entity_id: binary_sensor.toilet_on_off
state: 'on'
for: 00:05:00
sequence:
- service: switch.turn_off
entity_id: switch.toilet
- conditions:
- condition: state
entity_id: binary_sensor.toilet_on_off
state: 'on'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.toilet
mode: single
- id: '1612988850571'
alias: Pantry
description: Switch the light in the pantry when the door is opened or closed.
trigger:
- platform: state
entity_id: binary_sensor.pantry_on_off
- platform: state
entity_id: binary_sensor.pantry_on_off
for: 00:10:00
to: 'on'
condition: []
action:
- choose:
- conditions:
condition: or
conditions:
- condition: state
entity_id: binary_sensor.pantry_on_off
for: 00:10:00
state: 'on'
- condition: state
entity_id: binary_sensor.pantry_on_off
state: 'off'
sequence:
- service: light.turn_off
entity_id: light.pantry
default:
- service: light.turn_on
entity_id: light.pantry
mode: single
- id: '1612991117230'
alias: Attic remote
description: Handles all the events for the attic from a Philips remote. It controls
one light (short press) and one heater (long press).
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: d2d1de274ba99aa61fa79c7b3f8e64c1
endpoint_id: 2
cluster_id: 64512
condition: []
action:
- variables:
command: '{{ trigger.event.data.command }}'
- choose:
- conditions:
- '{{ command == ''on_press'' }}'
sequence:
- service: light.turn_on
entity_id: light.attic
- service: automation.turn_off
data: {}
entity_id: automation.attic_motion
- conditions:
- '{{ command == ''off_press'' }}'
sequence:
- service: light.turn_off
entity_id: light.attic
- service: automation.turn_on
data: {}
entity_id: automation.attic_motion
- conditions:
- '{{ command == ''up_press'' }}'
sequence:
- service: light.turn_on
entity_id: light.attic
data:
brightness_step_pct: 20
- conditions:
- '{{ command == ''down_press'' }}'
sequence:
- service: light.turn_on
entity_id: light.attic
data:
brightness_step_pct: -20
- conditions:
- '{{ command == ''up_long_release'' }}'
sequence:
- service: light.turn_on
entity_id: light.attic
data:
brighness_pct: 100
color_temp: 300
- conditions:
- '{{ command == ''down_long_relase'' }}'
sequence:
- service: light.turn_on
entity_id: light.attic
data:
brightness_pct: 0
color_temp: 454
- conditions:
- '{{ command == ''on_long_release'' }}'
sequence:
- service: climate.turn_on
entity_id: climate.radiator_attic
- conditions:
- '{{ command == ''off_long_release'' }}'
sequence:
- service: climate.turn_off
entity_id: climate.radiator_attic
default: []
mode: single
- id: '1613142961491'
alias: Heater
description: Auto turn off the heater at certain times, to make sure it is not unintenionally
long turned on.
trigger:
- platform: time
at: '21:00:00'
- platform: time
at: '23:59:59'
condition: []
action:
- service: climate.turn_off
data: {}
entity_id: climate.attic
mode: single
- id: '1613577759701'
alias: Bright
description: ''
trigger:
- platform: time_pattern
minutes: /5
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{ state_attr(''sun.sun'', ''elevation'') < -6 }}'
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.bright
default:
- service: input_boolean.turn_on
entity_id: input_boolean.bright
mode: single
- id: '1613720614532'
alias: Bathroom
description: Put light on when door is opened. Put off when closed for 10 minutes.
Put off when nothing has changed for 30 minutes.
trigger:
- platform: state
entity_id: switch.bathroom
to: 'on'
for: 00:30:00
- platform: state
entity_id: binary_sensor.bathroom_on_off
to: 'on'
- platform: state
entity_id: binary_sensor.bathroom_on_off
to: 'off'
for: 00:10:00
condition:
- condition: state
entity_id: climate.bathroom
state: 'off'
action:
- choose:
- alias: Presumed forgotten to switch light off
conditions:
- condition: state
entity_id: binary_sensor.bathroom_on_off
state:
- 'on'
- 'off'
for: 00:30:00
sequence:
- service: switch.turn_off
entity_id: switch.bathroom
- alias: Presumed people in bathroom
conditions:
- condition: state
entity_id: binary_sensor.bathroom_on_off
state: 'on'
sequence:
- service: switch.turn_on
entity_id: switch.bathroom
- alias: Presumed empty bathroom
conditions:
- condition: state
entity_id: binary_sensor.bathroom_on_off
state: 'off'
for: 00:10:00
sequence:
- service: switch.turn_off
entity_id: switch.bathroom
mode: single
- id: '1614112596198'
alias: Bike motion
description: When it is dark and there is motion, put on the lights in the bike
shed. Else, put off. Note that this automation can be turned off by automation.bike_button.
trigger:
- platform: state
entity_id: binary_sensor.bike_on_off
condition: []
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.hall_illuminance
below: 10
- condition: state
entity_id: binary_sensor.bike_on_off
state: 'on'
sequence:
- service: switch.turn_on
entity_id: switch.bike_light
default:
- service: switch.turn_off
entity_id: switch.bike_light
mode: single
- id: '1614152225581'
alias: Bike button
description: When the on button is pressed, put the lights on and disable the motion
sensor. When the off button is pressed, put the lights off and enable the motion
sensor after 60 seconds.
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: 9eadf9239ebb9bc268ad74c2eae0602d
condition: []
action:
- variables:
command: '{{ trigger.event.data.command }}'
- choose:
- conditions:
- condition: template
value_template: '{{ command == ''on'' }}'
sequence:
- service: switch.turn_on
entity_id: switch.bike_light
- service: automation.turn_off
entity_id: automation.bike_motion
- conditions:
- condition: template
value_template: '{{ command == ''off'' }}'
sequence:
- service: switch.turn_off
entity_id: switch.bike_light
- delay:
hours: 0
minutes: 1
seconds: 0
milliseconds: 0
- service: automation.turn_on
entity_id: automation.bike_motion
mode: restart