forked from robwolff3/homeassistant-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththings.yaml
executable file
·461 lines (389 loc) · 12.7 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
#################################################################
## 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:
espresso_enabled:
initial: off
input_datetime:
espresso_time:
has_date: false
has_time: true
#################################################################
## Automations
automation:
#Roomba logic
# Sceduled Roobma!!
- alias: Roomba On Weekdays
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}}'
action:
- service: homeassistant.turn_on
entity_id: vacuum.roomba
# Notify when Roomba is stuck or stopped
- alias: Roomba notify stuck or stopped
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 is finished
- alias: Roomba notify finished
trigger:
- platform: state
entity_id: sensor.roomba_status
from: 'User Docking'
to: 'Charging'
- platform: state
entity_id: sensor.roomba_status
from: 'Docking - End Mission'
to: 'Charging'
action:
- service: notify.html5
data:
title: 'Roomba Finished - {{now().strftime("%l:%M %P")}}'
message: 'Schmidt is finished and bin needs emptying.'
data:
requireInteraction: true
renotify: true
tag: 'roomba_notify'
# Notify when Roomba battery very low
- alias: Roomba notify battery very low
trigger:
- platform: template
value_template: '{{states.vacuum.roomba.attributes.battery_level < 11}}'
action:
- service: notify.html5
data:
title: 'Roomba Error - {{now().strftime("%l:%M %P")}}'
message: 'Schmidt battery is 10%.'
data:
requireInteraction: true
renotify: true
tag: 'roomba_notify'
#Dishwasher logic
# Dishwasher set running
- alias: Set dishwasher active when power detected
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
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
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
trigger:
- platform: state
entity_id: input_select.dishwasher_status
to: 'Off'
action:
- service: notify.html5
data:
title: 'Dishwasher Finished - {{now().strftime("%l:%M %P")}}'
message: 'The Dishwasher has finished and is ready to be emptied.'
data:
requireInteraction: true
- service: google_keep.add_to_list
data_template:
title: 'Rob To Do'
items: 'Empty Dishwasher - {{now().strftime("%l:%M %P")}}'
# Check for things left on
- alias: Check for things left on
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: '/states'
actions:
- action: 'turn_off'
title: 'Turn off'
# Turn off when notifcation clicked
- alias: Turn off notifcation
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
trigger:
- platform: state
entity_id: input_select.dishwashers_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_template:
message: >
{{ [
"The Dishwasher has finished and is ready to be emptied.",
"The dishwasher is done, hope someone is ready to put dishes away.",
"I have clean dishes hot off the press, the dishwasher is done."
] | random }}
# Say package is delivered
- alias: Say package is delivered
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_template:
message: >
{{ [
"A package has been delivered, hope its something good.",
"A delivery has been made, better grab it before a porch pirate does.",
"You can stop checking the front door, a package has been delivered."
] | random }}
- 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
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_template:
message: !secret user1_phrase
# Espresso Scheduler
- alias: Espresso Scheduler
trigger:
- platform: template
value_template: "{{ states('sensor.time') == (states.input_datetime.espresso_time.attributes.timestamp | int | timestamp_custom('%H:%M', False)) }}"
condition:
- condition: state
entity_id: input_boolean.espresso_enabled
state: 'on'
action:
- service: homeassistant.turn_on
entity_id: switch.kitchen_outlet_switch
- service: input_boolean.turn_off
data:
entity_id: input_boolean.espresso_enabled
# Espresso Notify
- alias: Espresso Notify
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: 'Espresso machine is warmed up.'
data:
requireInteraction: true
- service: notify.ga_broadcast
data_template:
message: >
{{ [
"Hey sleepy head, the espresso machine is all warmed up.",
"I hope there is a barista somewhere because the espresso machine is ready.",
"Someone start grinding the beans, the expresso machine is at tempature."
] | random }}
- alias: haalert
initial_state: 'off'
trigger:
- platform: state
entity_id: binary_sensor.user1_occupancy, binary_sensor.user3_occupancy, binary_sensor.user4_occupancy, binary_sensor.frontdoor_contact, binary_sensor.sidedoor_contact, binary_sensor.backdoor_contact
from: 'off'
to: 'on'
action:
- service: notify.html5
data:
title: 'HA Alert - {{now().strftime("%l:%M %P")}}'
message: 'HA Alert'
data:
requireInteraction: true