-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy paththings.yaml
executable file
·511 lines (435 loc) · 13.8 KB
/
things.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
#################################################################
## Scripts
script:
roomba_on:
sequence:
- service: homeassistant.turn_on
entity_id: vacuum.roomba
#################################################################
## Sensors
sensor:
- platform: template
sensors:
dishwasher_status:
value_template: '{{ states.input_select.dishwasher_status.state}}'
friendly_name: 'Dishwasher Status'
- platform: template
sensors:
roomba_status:
value_template: '{{ states.vacuum.roomba.attributes.status}}'
friendly_name: 'Roomba Status'
##################################################
## Inputs
input_select:
dishwasher_status:
initial: 'Off'
options:
- Running
- Drying
- 'Off'
input_boolean:
disable_roomba_schedule:
disable_bathroom_heater:
disable_bathroom_heater_schedule:
disable_nest:
#################################################################
## Automations
automation:
#Roomba logic
# Sceduled Roobma!!
- alias: Roomba On Weekdays
initial_state: True
trigger:
- platform: time
at: '10:00:00'
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
- condition: template
value_template: '{{states.vacuum.roomba.attributes.battery_level > 79}}'
- condition: state
entity_id: input_boolean.disable_roomba_schedule
state: 'off'
action:
- service: homeassistant.turn_on
entity_id: vacuum.roomba
# Notify when Roomba is stuck or stopped
- alias: Roomba notify stuck or stopped
initial_state: True
trigger:
- platform: state
entity_id: vacuum.roomba
to: 'off'
for:
minutes: 1
condition:
condition: or
conditions:
- condition: template
value_template: '{{states.vacuum.roomba.attributes.status == "Stuck"}}'
- condition: template
value_template: '{{states.vacuum.roomba.attributes.status == "Stopped"}}'
action:
- service: notify.html5
data:
title: 'Roomba Error - {{now().strftime("%l:%M %P")}}'
message: 'Schmidt is stuck or something else stopped him.'
data:
requireInteraction: true
renotify: true
tag: 'roomba_notify'
# Notify when Roomba battery very low
- alias: Roomba notify battery very low
initial_state: True
trigger:
- platform: template
value_template: '{{states.vacuum.roomba.attributes.battery_level < 5}}'
action:
- service: notify.html5
data:
title: 'Roomba Error - {{now().strftime("%l:%M %P")}}'
message: 'Schmidt battery is 5%.'
data:
requireInteraction: true
renotify: true
tag: 'roomba_notify'
#Dishwasher logic
# Dishwasher set running
- alias: Set dishwasher active when power detected
initial_state: True
trigger:
- platform: numeric_state
entity_id: sensor.meter_outlet_power
above: 10
condition:
- condition: state
entity_id: input_select.dishwasher_status
state: 'Off'
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: Running
# Dishwasher set drying
- alias: Set dishwasher drying when power drops
initial_state: True
trigger:
- platform: numeric_state
entity_id: sensor.meter_outlet_power
below: 600
above: 380
for:
minutes: 2
condition:
- 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
# Dishwasher set off
- alias: Set dishwasher off
initial_state: True
trigger:
- platform: numeric_state
entity_id: sensor.meter_outlet_power
below: 5
for:
minutes: 6
condition:
- condition: state
entity_id: input_select.dishwasher_status
state: Drying
action:
- service: input_select.select_option
data:
entity_id: input_select.dishwasher_status
option: 'Off'
# Text and add to todo Dishwasher Alert when done
- alias: Send text alert when dishwasher is done
initial_state: True
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: 'Off'
action:
- service: notify.html5
data:
title: 'Dishwasher Finished - {{now().strftime("%m/%d - %l:%M%P")}}'
message: 'The Dishwasher has finished and is ready to be emptied.'
data:
requireInteraction: true
# Check for things left on
- alias: Check for things left on
initial_state: True
trigger:
- platform: state
entity_id: binary_sensor.user1_occupancy, binary_sensor.user2_occupancy
from: 'on'
to: 'off'
condition:
condition: and
conditions:
- condition: state
entity_id: binary_sensor.user1_occupancy
state: 'off'
- condition: state
entity_id: binary_sensor.user2_occupancy
state: 'off'
- condition: or
conditions:
- condition: template
value_template: '{{states.light.livingroom_light_level.attributes.brightness > 128}}'
- condition: template
value_template: '{{states.light.kitchen_light_level.attributes.brightness > 128}}'
- condition: state
entity_id: light.diningroom_light_level
state: 'on'
- condition: state
entity_id: light.bedroom_light_level
state: 'on'
- condition: state
entity_id: light.bathroom_light_level
state: 'on'
- condition: state
entity_id: light.nightstand1
state: 'on'
- condition: state
entity_id: light.nightstand2
state: 'on'
- condition: state
entity_id: switch.bedroom_outlet_switch_3
state: 'on'
- condition: state
entity_id: switch.kitchen_outlet_switch
state: 'on'
- condition: state
entity_id: media_player.viziotv
state: 'on'
- condition: state
entity_id: media_player.nadc338
state: 'on'
action:
- service: notify.html5
data:
title: 'Something left on - {{now().strftime("%l:%M %P")}}'
message: 'A light or outlet was left on.'
data:
requireInteraction: true
renotify: true
url: '/lovelace/home'
actions:
- action: 'turn_off'
title: 'Turn off'
# Turn off when notifcation clicked
- alias: Turn off notifcation
initial_state: True
trigger:
- platform: event
event_type: html5_notification.clicked
event_data:
action: turn_off
action:
- service: scene.turn_on
entity_id: scene.all_things_off
# Say Dishwasher Alert when done
- alias: Say alert when dishwasher is done
initial_state: True
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: 'Off'
condition:
condition: and
conditions:
- condition: time
after: '08:00:00'
before: '20:00:00'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.user1_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.user2_occupancy
state: 'on'
action:
- service: notify.ga_broadcast
data:
message: "The Dishwasher has finished."
# Say package is delivered
- alias: Say package is delivered
initial_state: True
trigger: #Dummy Trigger
- platform: state
entity_id: input_select.dishwasher_status
to: 'Dead'
condition:
condition: and
conditions:
- condition: time
after: '08:00:00'
before: '20:00:00'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.user1_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.user2_occupancy
state: 'on'
action:
- service: notify.ga_broadcast
data:
message: "A package has been delivered."
- service: notify.html5
data:
title: 'Package Delivered - {{now().strftime("%l:%M %P")}}'
message: 'A package has been delivered.'
data:
requireInteraction: true
renotify: true
tag: 'package_notify'
## Welcome Home User1 Broadcast
- alias: Say welcome home user1
initial_state: True
trigger:
- platform: template
value_template: '{{states.lock.front_door_handle_locked.attributes.lock_status == "Unlocked with Keypad by user 1"}}'
condition:
- condition: template
value_template: "{{ (as_timestamp(now())-as_timestamp(states.binary_sensor.user1_occupancy.last_changed)) < 240 }}"
- condition: time
after: '10:00:00'
before: '19:00:00'
action:
- delay: '00:00:05'
- service: notify.ga_broadcast
data:
message: !secret user1_phrase
# Espresso Notify
- alias: Espresso Notify
initial_state: True
trigger:
platform: state
entity_id: switch.kitchen_outlet_switch
to: 'on'
for:
minutes: 30
action:
- service: notify.html5
data:
title: 'Espresso Ready - {{now().strftime("%l:%M %P")}}'
message: 'The espresso machine is warmed up.'
data:
requireInteraction: true
- service: notify.ga_broadcast
data:
message: "The expresso machine is warmed up."
# Keep nest from going into eco mode when people are home
- alias: antiecomode
initial_state: True
trigger:
- platform: state
entity_id: climate.dining_room
to: 'eco'
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.disable_nest
state: 'off'
- condition: or
conditions:
- condition: state
entity_id: binary_sensor.user1_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.user2_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.user3_occupancy
state: 'on'
- condition: state
entity_id: binary_sensor.user4_occupancy
state: 'on'
action:
- delay: '00:00:30'
- service: climate.set_operation_mode
data:
entity_id: climate.dining_room
operation_mode: auto
# Bathroom heater on with motion
- alias: Heater - Bathroom Motion On
initial_state: True
trigger:
- platform: state
entity_id: binary_sensor.bathroom_motion_sensor
to: 'on'
- platform: state
entity_id: light.bathroom_light_level
to: 'on'
condition:
- condition: state
entity_id: switch.livingroom_outlet_switch_3
state: 'off'
- condition: state
entity_id: input_boolean.disable_bathroom_heater
state: 'off'
- condition: template
value_template: '{{states.weather.dark_sky.attributes.temperature < 40}}'
- condition: template
value_template: '{{states.weather.dark_sky.attributes.temperature > 10}}'
action:
service: homeassistant.turn_on
entity_id: switch.livingroom_outlet_switch_3
- alias: Heater - Bathroom Motion Off
initial_state: True
trigger:
- platform: state
entity_id: binary_sensor.bathroom_motion_sensor
to: 'off'
from: 'on'
for:
minutes: 6
- platform: state
entity_id: light.bathroom_light_level
to: 'off'
condition:
- condition: state
entity_id: input_boolean.disable_bathroom_heater
state: 'off'
- condition: template
value_template: '{{states.weather.dark_sky.attributes.temperature < 40}}'
- condition: template
value_template: '{{states.weather.dark_sky.attributes.temperature > 10}}'
action:
service: homeassistant.turn_off
entity_id: switch.livingroom_outlet_switch_3
# Bathroom heater frezing manual schedule
- alias: Heater - Manual Schedule
initial_state: True
trigger:
- platform: time_pattern
hours: '/1'
minutes: 0
seconds: 0
condition:
- condition: state
entity_id: input_boolean.disable_bathroom_heater_schedule
state: 'off'
- condition: template
value_template: '{{states.weather.dark_sky.attributes.temperature < 11}}'
action:
- service: homeassistant.turn_on
entity_id: switch.livingroom_outlet_switch_3
- delay: 00:30:00
- service: homeassistant.turn_off
entity_id: switch.livingroom_outlet_switch_3