-
Notifications
You must be signed in to change notification settings - Fork 1
/
automations.yaml
692 lines (656 loc) · 17.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
- id: close_bedroom_shutters_when_sun_sets
alias: 'Close bedroom shutters when sun sets'
trigger:
platform: sun
event: sunset
condition:
condition: state
entity_id: group.bedroom_covers
state: open
action:
- service: cover.close_cover
entity_id: group.bedroom_covers
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The bedroom shutters are closing
- id: close_iness_room_shutter_when_sun_sets
alias: "Close Inês's room shutter when sun sets"
trigger:
platform: sun
event: sunset
condition:
condition: state
entity_id: group.iness_room_covers
state: open
action:
- service: cover.close_cover
entity_id: group.iness_room_covers
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: Inês's room shutter is closing
- id: close_kitchen_shutters_when_sun_sets
alias: 'Close kitchen shutters when sun sets'
trigger:
platform: sun
event: sunset
condition:
condition: state
entity_id: group.kitchen_covers
state: open
action:
- service: cover.close_cover
entity_id: group.kitchen_covers
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The kitchen shutters are closing
- id: close_living_room_shutter_at_23_00
alias: 'Close living room shutter at 23:00'
trigger:
platform: time
at: '23:00:00'
condition:
condition: state
entity_id: group.living_room_covers
state: open
action:
- service: cover.close_cover
entity_id: group.living_room_covers
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The living room shutter is closing
- id: close_office_shutter_when_sun_sets
alias: 'Close office shutter when sun sets'
trigger:
platform: sun
event: sunset
condition:
condition: state
entity_id: group.office_covers
state: open
action:
- service: cover.close_cover
entity_id: group.office_covers
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The office shutter is closing
- id: lower_living_room_shutter_when_sun_sets
alias: 'Lower living room shutter when sun sets'
trigger:
platform: sun
event: sunset
condition:
condition: numeric_state
entity_id: cover.living_room_shutter_level
value_template: '{{ state.attributes.current_position }}'
above: 25
action:
- service: cover.set_cover_position
entity_id: group.living_room_covers
data:
position: 25
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The living room shutter is lowering to 25%
- id: notify_if_dryer_has_finished
alias: 'Notify if dryer has finished'
trigger:
platform: state
entity_id: binary_sensor.dryer_status
to: 'off'
for:
minutes: 5
action:
service: notify.family
data:
message: The dryer has finished its cycle.
- id: notify_if_front_door_was_opened_after_02_00
alias: 'Notify if front door was opened after 02:00'
trigger:
platform: state
entity_id: binary_sensor.front_door_sensor
to: 'on'
condition:
condition: time
after: '02:00:00'
before: '07:00:00'
action:
service: notify.family
data:
message: The front door was opened after 02:00.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.front_door.attributes.entity_picture }}'
caption: The front door was opened after 02:00.
- id: notify_if_front_door_camera_detects_motion
alias: 'Notify if front door camera detects motion'
trigger:
platform: state
entity_id: binary_sensor.front_door_motion
to: 'on'
action:
service: notify.family
data:
message: The front door camera has detected motion.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.front_door.attributes.entity_picture }}'
caption: The front door camera has detected motion.
- id: notify_if_front_door_was_opened_and_nobody_is_home
alias: 'Notify if front door was opened and nobody is home'
trigger:
platform: state
entity_id: binary_sensor.front_door_sensor
to: 'on'
condition:
condition: state
entity_id: group.all_devices
state: not_home
action:
service: notify.family
data:
message: The front door was opened and nobody is home.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.front_door.attributes.entity_picture }}'
caption: The front door was opened and nobody is home.
- id: notify_if_family_is_visiting
alias: 'Notify if family is visiting'
trigger:
platform: state
entity_id: group.extended_family
to: home
condition:
condition: state
entity_id: group.family
state: not_home
action:
service: notify.family
data:
message: |
{%- for entity in states.group.extended_family.attributes.entity_id -%}
{%- if is_state(entity, 'home') %}
{{ states.device_tracker[entity.split('.')[1]].name }} is visiting.
{%- endif -%}
{%- endfor %}
- id: notify_if_garage_door_is_open_and_nobody_is_home
alias: 'Notify if garage door is open and nobody is home'
trigger:
platform: state
entity_id: group.all_devices
to: not_home
condition:
condition: state
entity_id: cover.garage_door
state: open
action:
service: notify.family
data:
message: The garage door is open and nobody is home.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.front_door.attributes.entity_picture }}'
caption: The garage door is open and nobody is home.
- id: notify_if_garage_door_was_opened_after_02_00
alias: 'Notify if garage door was opened after 02:00'
trigger:
platform: state
entity_id: cover.garage_door
to: 'open'
condition:
condition: time
after: '02:00:00'
before: '07:00:00'
action:
service: notify.family
data:
message: The garage door was opened after 02:00.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.front_door.attributes.entity_picture }}'
caption: The garage door was opened after 02:00.
- id: notify_if_mailbox_was_opened
alias: 'Notify if mailbox was opened'
trigger:
platform: mqtt
topic: /ha-mailbox/rssi/
action:
service: notify.family
data:
message: The mailbox was opened.
- id: notify_if_washer_has_finished
alias: 'Notify if washer has finished'
trigger:
platform: state
entity_id: binary_sensor.washer_status
to: 'off'
for:
minutes: 5
action:
service: notify.family
data:
message: The washer has finished its cycle.
- id: notify_if_a_plant_needs_watering
alias: 'Notify if a plant needs watering'
trigger:
- platform: numeric_state
entity_id: sensor.citrus_hystrix_moisture
below: 25
- platform: numeric_state
entity_id: sensor.ficus_benjamina_moisture
below: 25
- platform: numeric_state
entity_id: sensor.fiddle_leaf_moisture
below: 25
- platform: numeric_state
entity_id: sensor.grass_moisture
below: 25
- platform: numeric_state
entity_id: sensor.monstera_deliciosa_moisture
below: 25
action:
service: notify.family
data_template:
message: The {{ trigger.to_state.name }} is at {{ trigger.to_state.state }}% and needs watering.
- id: notify_if_printer_has_finished
alias: 'Notify if printer has finished'
trigger:
platform: state
entity_id: sensor.octoprint_current_state
from: 'Printing'
condition:
condition: numeric_state
entity_id: sensor.octoprint_job_percentage
above: 85
action:
service: notify.family
data:
message: Your print is finished.
data:
photo:
url: '{{ states.sensor.home_assistant_url.state }}{{ states.camera.octoprint.attributes.entity_picture }}'
caption: Your print is finished.
- id: notify_if_it_starts_to_rain
alias: 'Notify if it starts to rain'
trigger:
platform: template
value_template: '{{ states.sensor.yr_precipitation.state | int > 1 }}'
action:
service: notify.family
data:
message: It is currently {{ states.sensor.yr_temperature.state | int }}º C and raining {{ states.sensor.yr_precipitation.state }} mm.
- id: open_bedroom_shutters_at_09_30_on_weekdays
alias: 'Open bedroom shutters at 09:30 on weekdays'
trigger:
platform: time
at: '09:30:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: group.bedroom_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.bedroom_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The bedroom shutters are rising to 50%
- id: open_bedroom_shutters_at_13_00_on_weekends
alias: 'Open bedroom shutters at 13:00 on weekends'
trigger:
platform: time
at: '13:00:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: group.bedroom_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.bedroom_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The bedroom shutters are rising to 50%
- id: open_iness_room_shutter_at_09_30_on_weekdays
alias: "Open Inês's room shutter at 09:30 on weekdays"
trigger:
platform: time
at: '09:30:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: group.iness_room_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.iness_room_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: Inês's room shutter is rising to 50%
- id: open_iness_room_shutter_at_13_00_on_weekends
alias: "Open Inês's room shutter at 13:00 on weekends"
trigger:
platform: time
at: '13:00:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: group.iness_room_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.iness_room_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: Inês's room shutter is rising to 50%
- id: open_kitchen_shutters_at_08_00
alias: 'Open kitchen shutters at 08:00'
trigger:
platform: time
at: '08:00:00'
condition:
condition: state
entity_id: group.kitchen_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.kitchen_covers
data:
position: 75
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The kitchen shutters are rising to 75%
- id: open_living_room_shutter_at_08_00
alias: 'Open living room shutter at 08:00'
trigger:
platform: time
at: '08:00:00'
condition:
condition: state
entity_id: group.living_room_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.living_room_covers
data:
position: 75
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The living room shutter is rising to 75%
- id: open_office_shutter_at_09_30_on_weekdays
alias: 'Open office shutter at 09:30 on weekdays'
trigger:
platform: time
at: '09:30:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: state
entity_id: group.office_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.office_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The office shutter is rising to 50%
- id: open_office_shutter_at_13_00_on_weekends
alias: 'Open office shutter at 13:00 on weekends'
trigger:
platform: time
at: '13:00:00'
condition:
- condition: time
weekday:
- sat
- sun
- condition: state
entity_id: group.office_covers
state: closed
action:
- service: cover.set_cover_position
entity_id: group.office_covers
data:
position: 50
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The office shutter is rising to 50%
- id: start_homekit_after_zwave_network_ready
alias: 'Start HomeKit after Z-Wave network is ready'
trigger:
- platform: event
event_type: zwave.network_ready
action:
- service: homekit.start
- id: turn_off_lights_if_everyone_leaves
alias: 'Turn off lights if everyone leaves'
trigger:
platform: state
entity_id: group.family
to: not_home
condition:
condition: state
entity_id: group.all_lights
state: 'on'
action:
- service: light.turn_off
entity_id: group.all_lights
- service: notify.family
data:
message: The lights were turned off because nobody is home
- id: turn_off_living_room_ac_at_01_00
alias: 'Turn off living room AC at 01:00'
trigger:
platform: time
at: '01:00:00'
action:
- service: climate.set_operation_mode
entity_id: climate.living_room_ac
data:
operation_mode: idle
- id: turn_off_living_room_lamp_at_23_00
alias: 'Turn off living room lamp at 23:00'
trigger:
platform: time
at: '23:00:00'
condition:
condition: state
entity_id: light.living_room_lamp
state: 'on'
action:
- service: light.turn_off
entity_id: light.living_room_lamp
- id: turn_off_tv_if_everyone_leaves
alias: 'Turn off TV if everyone leaves'
trigger:
platform: state
entity_id: group.family
to: not_home
condition:
condition: state
entity_id: media_player.living_room_tv
state: 'on'
action:
- service: media_player.turn_off
entity_id: media_player.living_room_tv
- service: notify.family
data:
message: The TV was turned off because nobody is home
- id: turn_off_tv_lights_when_tv_is_turned_off
alias: 'Turn off TV lights when TV is turned off'
trigger:
platform: state
entity_id: media_player.living_room_tv
to: 'off'
condition:
condition: state
entity_id: light.tv_lights
state: 'on'
action:
- service: light.turn_off
entity_id: light.tv_lights
- id: turn_off_xmas_lights_at_02_00
alias: 'Turn off X-mas lights at 02:00'
trigger:
platform: time
at: '02:00:00'
condition:
condition: state
entity_id: switch.haxmaslights
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.haxmaslights
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The X-mas lights were turned off
- id: turn_off_xmas_lights_if_everyone_leaves
alias: 'Turn off X-mas lights if everyone leaves'
trigger:
platform: state
entity_id: group.all_devices
to: not_home
condition:
condition: state
entity_id: switch.haxmaslights
state: 'on'
action:
- service: switch.turn_off
entity_id: switch.haxmaslights
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The X-mas lights were turned off
- id: turn_on_living_room_lamp_in_the_evening
alias: 'Turn on living room lamp in the evening'
trigger:
platform: numeric_state
entity_id: sensor.living_room_multisensor_luminance
below: 8
condition:
- condition: state
entity_id: group.all_devices
state: home
- condition: time
after: '17:00'
before: '23:00'
action:
- service: light.turn_on
entity_id: light.living_room_lamp
- id: turn_on_living_room_lamp_when_someone_arrives
alias: 'Turn on living room lamp when someone arrives'
trigger:
platform: state
entity_id: group.all_devices
to: home
condition:
- condition: state
entity_id: light.living_room_lamp
state: 'off'
- condition: numeric_state
entity_id: sensor.living_room_multisensor_luminance
below: 8
- condition: time
after: '17:00'
before: '23:00'
action:
- service: light.turn_on
entity_id: light.living_room_lamp
- id: turn_on_xmas_lights_when_someone_arrives
alias: 'Turn on X-mas lights when someone arrives'
trigger:
platform: state
entity_id: group.all_devices
to: home
condition:
condition: state
entity_id: switch.haxmaslights
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.haxmaslights
- condition: state
entity_id: group.family
state: not_home
- service: notify.family
data:
message: The X-mas lights were turned on