/
automations.yaml
519 lines (509 loc) · 14.2 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
- id: someone_arrived_home
alias: Someone arrived home
trigger:
- entity_id: person.robbie_trencheny, person.eddie_sun, person.wilson_zhong
from: not_home
platform: state
to: home
action:
- data:
data:
push:
sound: US-EN-Morgan-Freeman-Roommate-Is-Arriving.wav
thread-id: presence-changed
data_template:
message: '{{ trigger.to_state.attributes.friendly_name }} has arrived at home.
{% for name, zone in states.person|groupby(''state'') %}{% if zone|length
> 0 %}{% for device in zone %}{% if loop.last and loop|length > 1 %} and {%
elif not loop.first and loop|length > 1 %}, {% endif %}{{ device.name }}{%
endfor %}{% if zone|length == 1 %} is{% if name != "not_home" %} at{% endif
%}{% else %} are{% endif %} {{ name|replace(''_'', '' '') }}.{% endif %} {%
endfor %}
'
title: Roommate has arrived at home
service: notify.humansanddisplays
- id: someone_left_home
alias: Someone left home
trigger:
- entity_id: person.robbie_trencheny, person.eddie_sun, person.wilson_zhong
from: home
platform: state
to: not_home
action:
- data:
data:
push:
thread-id: presence-changed
data_template:
message: '{{ trigger.to_state.attributes.friendly_name }} has left home.
{% for name, zone in states.person|groupby(''state'') %}{% if zone|length
> 0 %}{% for device in zone %}{% if loop.last and loop|length > 1 %} and {%
elif not loop.first and loop|length > 1 %}, {% endif %}{{ device.name }}{%
endfor %}{% if zone|length == 1 %} is{% if name != "not_home" %} at{% endif
%}{% else %} are{% endif %} {{ name|replace(''_'', '' '') }}.{% endif %} {%
endfor %}
'
title: Roommate has left home
service: notify.humansanddisplays
- alias: Set dishwasher active when power detected
id: set_dishwasher_active
trigger:
- platform: numeric_state
entity_id: sensor.dishwasher_power
above: 10
condition:
condition: or
conditions:
- condition: state
entity_id: input_select.dishwasher_status
state: Dirty
- condition: state
entity_id: input_select.dishwasher_status
state: Clean
- condition: state
entity_id: input_select.dishwasher_status
state: Drying
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: Running
- alias: Set dishwasher drying when power drops
id: set_dishwasher_drying
trigger:
- platform: numeric_state
entity_id: sensor.dishwasher_power
below: 10
condition:
condition: and
conditions:
- condition: state
entity_id: input_select.dishwasher_status
state: Running
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: Drying
- alias: Set dishwasher clean
id: set_dishwasher_clean
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: Drying
for:
minutes: 15
condition:
condition: and
conditions:
- condition: state
entity_id: input_select.dishwasher_status
state: Drying
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: Clean
- alias: Set Dishwasher dirty when power off
id: set_dishwasher_dirty
trigger:
- platform: numeric_state
entity_id: sensor.dishwasher_power
below: 1
condition:
condition: and
conditions:
- condition: numeric_state
entity_id: sensor.dishwasher_power
below: 1
- condition: or
conditions:
- condition: state
entity_id: input_select.dishwasher_status
state: Clean
- condition: state
entity_id: input_select.dishwasher_status
state: Drying
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: Dirty
- alias: Send alert when dishwasher is clean
id: send_dishwasher_alert
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: Clean
condition:
condition: and
conditions:
- condition: state
entity_id: input_select.dishwasher_status
state: Clean
action:
- service: notify.humansanddisplays
data:
message: The Dishwasher has finished and is ready to be emptied!
title: Dishwasher Update
- alias: Turn off all devices when everyone leaves home
id: turn_off_when_people_leave
trigger:
platform: state
entity_id: group.all_devices
from: home
to: not_home
action:
service: homeassistant.turn_off
- alias: Send notifications for package delivery
id: package_notifications
trigger:
platform: event
event_type: security.package_ready
action:
service_template: 'notify.{{ trigger.event.data.human }}iOSApp
'
data_template:
message: 'You have {{ trigger.event.data.number_of_ready_packages }} package(s)
ready to be picked up.
'
data:
title: Packages available
data:
push:
sound: US-EN-Alexa-Mail-Has-Arrived.wav
- alias: Send notifications for guests/misc calls from front desk
id: guest_notification
trigger:
platform: event
event_type: security.delivery_access_request
action:
service_template: 'notify.{{ trigger.event.data.human }}iOSApp
'
data:
title: Guest/delivery inbound
message: You have a guest or delivery.
data:
push:
sound: US-EN-Alexa-Mail-Has-Arrived.wav
- id: front_door_open
alias: Front door is open
trigger:
- entity_id: binary_sensor.front_door_sensor
from: 'off'
platform: state
to: 'on'
action:
- data:
data:
push:
sound: US-EN-Daisy-Front-Door-Open.wav
thread-id: front-door
message: The front door is open
title: Front door
service: notify.humansanddisplays
- alias: Turn on entrance hallway overhead when the door opens
id: turn_on_entrance_hallway
trigger:
platform: state
entity_id: binary_sensor.front_door_sensor
from: 'off'
to: 'on'
condition:
condition: state
entity_id: sun.sun
state: below_horizon
action:
service: script.turn_on
entity_id: script.1532904736916
- alias: Turn on living room lights when Apple TV is paused
id: turn_on_living_room_when_atv_pauses
trigger:
platform: state
entity_id: media_player.living_room_apple_tv
from: playing
to: paused
condition:
condition: state
entity_id: sun.sun
state: below_horizon
action:
service: light.turn_on
entity_id: group.living_room
data:
transition: 60
- alias: Turn off living room lights when Apple TV is playing
id: turn_off_living_room_when_atv_plays
trigger:
platform: state
entity_id: media_player.living_room_apple_tv
from: paused
to: playing
condition:
condition: state
entity_id: sun.sun
state: below_horizon
action:
service: light.turn_off
entity_id: group.living_room
- alias: Turn on Robbie's Room lights when Apple TV is paused
id: turn_on_robbies_room_when_media_pauses
trigger:
- platform: state
entity_id: media_player.robbies_room_apple_tv
from: playing
to: paused
condition:
condition: state
entity_id: sun.sun
state: below_horizon
action:
service: light.turn_on
entity_id: group.robbiesroom
data:
transition: 60
- alias: Turn off Robbie's Room lights when Apple TV is playing
id: turn_off_robbies_room_when_media_plays
trigger:
- platform: state
entity_id: media_player.robbies_room_apple_tv
from: paused
to: playing
condition:
condition: state
entity_id: sun.sun
state: below_horizon
action:
service: light.turn_off
entity_id: group.robbiesroom
- id: notify_motion_detected
alias: Notify if motion detected in living room or hallway when no one is home
trigger:
- entity_id: binary_sensor.interior_hallway_motion_sensor, binary_sensor.living_room_multisensor_sensor
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: person.robbie_trencheny
state: not_home
- condition: state
entity_id: person.eddie_sun
state: not_home
- condition: state
entity_id: person.wilson_zhong
state: not_home
action:
- data:
data:
push:
sound: US-EN-Alexa-Motion-Detected-Generic.wav
thread-id: motion-detected
data_template:
message: 'Motion detected on {{ trigger.to_state.attributes.friendly_name }}
but no one is home!
'
title: Motion detected
service: notify.allresidents
- id: robbie_arrived_home
alias: Robbie arrived home
trigger:
- entity_id: person.robbie_trencheny
from: not_home
platform: state
to: home
action:
- data:
brightness: 255
rgb_color:
- 255
- 255
- 255
entity_id: group.robbies_room
service: light.turn_on
- id: robbie_left_home
alias: Robbie left home
trigger:
- entity_id: person.robbie_trencheny
from: home
platform: state
to: not_home
action:
- entity_id: group.robbiesroom
service: script.turn_off
- id: robbies_door_open
alias: Notify if Robbie's door is opened when he isn't home
trigger:
- entity_id: binary_sensor.robbies_bedroom_door_sensor
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: person.robbie_trencheny
state: not_home
action:
- data_template:
message: 'Bedroom door is {% if trigger.to_state.state == "on" %}open{% else
%}closed{% endif %} (you aren''t at home!)
'
service: notify.robbiesdevices
- id: robbies_room_motion
alias: Notify if there is motion in Robbie's Room when he isn't home
trigger:
- entity_id: binary_sensor.robbies_bedroom_multisensor_sensor
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: person.robbie_trencheny
state: not_home
action:
- data:
data:
push:
sound: US-EN-Morgan-Freeman-Motion-In-Bedroom.wav
message: Motion in your bedroom (you aren't at home!)
service: notify.robbiesdevices
- alias: Send a notification 1 hour before sunset
id: before_sunset_notification
trigger:
platform: sun
event: sunset
offset: -01:00:00
action:
service: notify.robbiesdevices
data:
message: There is one hour remaining until sunset.
- id: sunset_notification
alias: End of day sunset notification
trigger:
- event: sunset
platform: sun
action:
- data:
data:
push:
sound: US-EN-Alexa-Good-Night.wav
data_template:
message: 'Sunset for {{ now().strftime(''%A %B %-d, %Y at %-I:%M %p'') }}! The
day''s high temperature in Oakland was {{ states.sensor.dark_sky_daytime_high_temperature_0d.state
}}{{ states.sensor.dark_sky_daytime_high_temperature_0d.unit_of_measurement
}}. The low temperature today was {{ states.sensor.dark_sky_daytime_low_temperature_0d.state
}}{{ states.sensor.dark_sky_daytime_low_temperature_0d.unit_of_measurement
}}. The current conditions are {{ states.sensor.dark_sky_minutely_summary.state|lower
}}. {% for name, zone in states.person|groupby(''state'') %}{% if zone|length
> 0 %}{% for device in zone %}{% if loop.last and loop|length > 1 %} and {%
elif not loop.first and loop|length > 1 %}, {% endif %}{{ device.name }}{%
endfor %}{% if zone|length == 1 %} is{% if name != "not_home" %} at{% endif
%}{% else %} are{% endif %} {{ name|replace(''_'', '' '') }}.{% endif %} {%
endfor %}
'
service: notify.robbiesdevices
- action:
- alias: Turn on living room lights
data:
entity_id:
- light.front_lamp
- light.living_room_overhead_lights_level
- light.living_room_window_led_strip
- light.rear_lamp
service: light.turn_on
alias: Turn living room lights on when holding dimmer switch
id: '1510187667467'
trigger:
- event_data:
scene_id: 1
scene_data: 3
event_type: zwave.scene_activated
platform: event
- action:
- alias: Turn off living room lights
data:
entity_id:
- light.front_lamp
- light.living_room_overhead_lights_level
- light.living_room_window_led_strip
- light.rear_lamp
service: light.turn_off
alias: Turn living room lights off when holding dimmer switch
id: '1510187667468'
trigger:
- event_data:
scene_id: 2
scene_data: 3
event_type: zwave.scene_activated
platform: event
- alias: Start HomeKit
trigger:
- platform: event
event_type: zwave.network_ready
- platform: event
event_type: zwave.network_complete
action:
- service: homekit.start
id: 510ba2270acd448ea87db01c598d19f4
- id: '1552385078690'
alias: Set theme for night
trigger:
- event: sunset
offset: 00:45:00
platform: sun
condition: []
action:
- data:
name: midnight
service: frontend.set_theme
- id: '1552385107202'
alias: Set theme for day
trigger:
- event: sunrise
offset: -00:30:00
platform: sun
condition: []
action:
- data:
name: default
service: frontend.set_theme
- id: '1552820217163'
alias: Set Robbie's Fan Timer
trigger:
- entity_id: input_select.robbies_fan_timer
platform: state
condition: []
action:
- data:
payload_template: '{{ states.input_select.robbies_fan_timer.state }}'
topic: robbies_room_fan/wind/set
service: mqtt.publish
- id: '1552820252245'
alias: Set Robbie's Fan Wind Mode
trigger:
- entity_id: input_select.robbies_fan_wind
platform: state
condition: []
action:
- data:
payload_template: '{{ states.input_select.robbies_fan_wind.state }}'
topic: robbies_room_fan/wind/set
service: mqtt.publish
- id: '1582085760208'
alias: UPS Changed State
trigger:
- event_type: nut.ups_event
platform: event
condition: []
action:
- data_template:
data:
push:
sound:
critical: 1
name: default
volume: 1
thread-id: nut
subtitle: '{{ trigger.event.data.notify_type }}'
message: '{{ trigger.event.data.notify_msg }}'
title: UPS changed state
service: notify.RobbiesDevices