-
-
Notifications
You must be signed in to change notification settings - Fork 505
/
alarm.yaml
executable file
·367 lines (326 loc) · 10.5 KB
/
alarm.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
#-------------------------------------------
# ALarm Related Packages
# @CCOSTAN
# Original Repo : https://github.com/CCOSTAN/Home-AssistantConfig
#-------------------------------------------
homeassistant:
customize_glob:
"device_tracker.nodemcu*":
icon: mdi:chip
"binary_sensor.mcu?_gpio*":
icon: mdi:security-home
customize:
binary_sensor.MCU1_GPIO4:
friendly_name: 'Paige Window'
binary_sensor.MCU1_GPIO5:
friendly_name: 'Front Door'
binary_sensor.MCU1_GPIO10:
friendly_name: 'Dining Room Windows'
binary_sensor.MCU1_GPIO12:
friendly_name: 'Interior Garage Door'
binary_sensor.MCU1_GPIO13:
friendly_name: 'Front Den Windows'
binary_sensor.MCU1_GPIO14:
friendly_name: 'Office Window'
binary_sensor.MCU2_GPIO4:
friendly_name: 'Dinette Windows'
binary_sensor.MCU2_GPIO5:
friendly_name: 'Back Door'
binary_sensor.MCU2_GPIO9:
friendly_name: 'Master Slider'
binary_sensor.MCU2_GPIO10:
friendly_name: 'Master Bathroom Window'
binary_sensor.MCU2_GPIO12:
friendly_name: 'Main Slider'
binary_sensor.MCU2_GPIO13:
friendly_name: 'Upstairs Bedroom Window'
binary_sensor.MCU2_GPIO14:
friendly_name: 'Justin Window'
binary_sensor.MCU3_GPIO4:
friendly_name: 'Stacey Bedroom Window'
binary_sensor.MCU3_GPIO5:
friendly_name: 'Carlo Bedroom Window'
binary_sensor.MCU3_GPIO10:
friendly_name: 'Master Bedroom Window'
binary_sensor.MCU3_GPIO14:
friendly_name: 'Upstairs Windows'
binary_sensor.MCU3_Light:
friendly_name: 'Panel Door'
group.entry_points:
friendly_name: Alarm Entry Points
group.interior_door:
friendly_name: Interior doors
#-------------------------------------------
mqtt:
binary_sensor:
- state_topic: "NodeMCU1/GPIO4/Status"
name: "MCU1_GPIO4"
unique_id: 6829f4c5-9f99-45c4-a5d9-3c7a42b05abe
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU1/GPIO5/Status"
name: "MCU1_GPIO5"
unique_id: f5db33bf-f1e6-4d92-a637-3db4865aa2f4
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU1/GPIO10/Status"
name: "MCU1_GPIO10"
unique_id: ed998ae1-6ca6-4af8-ad6b-415992579c4c
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU1/GPIO12/Status"
name: "MCU1_GPIO12"
unique_id: ba72e789-0550-4ce5-95de-f7cd93eec7a1
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU1/GPIO13/Status"
name: "MCU1_GPIO13"
unique_id: 862ed4ad-b704-4ec0-9385-0fdbdd3db4cb
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU1/GPIO14/Status"
name: "MCU1_GPIO14"
unique_id: e3c8a195-71d4-4a14-b14e-d21f261c768d
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO4/Status"
name: "MCU2_GPIO4"
unique_id: 27f7e335-fe5b-43d8-863f-8738dadf311e
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO5/Status"
name: "MCU2_GPIO5"
unique_id: a0d35c49-00ec-4f34-b70a-43e862be5d64
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO9/Status"
name: "MCU2_GPIO9"
unique_id: c12c6a9d-17ea-4a1d-874b-54d747251949
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO10/Status"
name: "MCU2_GPIO10"
unique_id: 4427df18-0f23-4f92-87bd-656275a0054e
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO12/Status"
name: "MCU2_GPIO12"
unique_id: 03b06196-9f7f-4324-ba60-133cfbf1ee01
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO13/Status"
name: "MCU2_GPIO13"
unique_id: 3dbcf4e1-f2e1-4bfd-9861-08cbd989c404
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU2/GPIO14/Status"
name: "MCU2_GPIO14"
unique_id: 04f1298a-4138-45a0-aeda-58334eec56f2
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU3/GPIO4/Status"
name: "MCU3_GPIO4"
unique_id: 4cefd30a-4695-4ea1-a0fe-f82535d8d950
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU3/GPIO5/Status"
name: "MCU3_GPIO5"
unique_id: 524b7e7e-af9b-471b-be61-e2d4590c23d4
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU3/GPIO10/Status"
name: "MCU3_GPIO10"
unique_id: def60584-261a-472c-ab52-a34d4ff3038e
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU3/GPIO14/Status"
name: "MCU3_GPIO14"
unique_id: 031b204f-fa31-4d5b-ac6e-24f26c4afb06
payload_on: 1
payload_off: 0
device_class: opening
- state_topic: "NodeMCU3/Light/Status"
name: "MCU3_Light"
unique_id: 0b3ec37b-1fe9-4a7f-9336-6079727d725e
payload_on: 1
payload_off: 0
device_class: opening
# input_boolean:
# elephant:
# name: Elephant
# initial: off
#-------------------------------------------
group:
entry_points:
entities:
- binary_sensor.MCU1_GPIO4
- binary_sensor.MCU1_GPIO5
- binary_sensor.MCU1_GPIO10
- binary_sensor.MCU1_GPIO12
- binary_sensor.MCU1_GPIO13
- binary_sensor.MCU1_GPIO14
- binary_sensor.MCU2_GPIO4
- binary_sensor.MCU2_GPIO5
- binary_sensor.MCU2_GPIO9
- binary_sensor.MCU2_GPIO10
- binary_sensor.MCU2_GPIO12
- binary_sensor.MCU2_GPIO13
- binary_sensor.MCU2_GPIO14
- binary_sensor.MCU2_GPIO15
- binary_sensor.MCU3_GPIO4
- binary_sensor.MCU3_GPIO5
- binary_sensor.MCU3_GPIO10
- binary_sensor.MCU3_GPIO14
# interior_door: - Moved out to Doors Group.
# entities:
# - binary_sensor.kitchen_door
# - binary_sensor.MCU3_Light
#-------------------------------------------#-------------------------------------------
automation:
- alias: 'Turn off HVAC in window/door is opened'
id: 417961da-b706-4d5f-b155-e3518d24f0bc
trigger:
- platform: state
entity_id:
- binary_sensor.MCU1_GPIO4
- binary_sensor.MCU1_GPIO5
- binary_sensor.MCU1_GPIO10
- binary_sensor.MCU1_GPIO12
- binary_sensor.MCU1_GPIO13
- binary_sensor.MCU1_GPIO14
- binary_sensor.MCU2_GPIO4
- binary_sensor.MCU2_GPIO5
- binary_sensor.MCU2_GPIO9
- binary_sensor.MCU2_GPIO10
- binary_sensor.MCU2_GPIO12
- binary_sensor.MCU2_GPIO13
- binary_sensor.MCU2_GPIO14
- binary_sensor.MCU3_GPIO4
- binary_sensor.MCU3_GPIO5
- binary_sensor.MCU3_GPIO10
- binary_sensor.MCU3_GPIO14
to: 'on'
from: 'off'
for:
minutes: 5
condition:
- condition: template
value_template: "{{ states('climate.downstairs') != 'off' }}"
action:
- service: climate.turn_off
data:
entity_id: climate.downstairs
- service: script.speech_engine
data:
value1: >-
{% set opening = state_attr(trigger.entity_id, "friendly_name")%}
{%- macro opening_sentence(opening) -%}
{{"Since the " ~ opening +" has been left open, I will turn off the air conditioners until you close it" }}
[Give a snarky reason for this action]
{%- endmacro -%}
{{opening_sentence(opening)}}
call_outside_weather: 1
call_inside_weather: 1
#-------------------------------------------#-------------------------------------------
- alias: 'Turn HVAC back on when all doors/windows are closed.'
id: 66833291-c504-4651-aac9-3cdbf98d20ea
trigger:
- platform: state
entity_id:
- group.entry_points
to: 'off'
from: 'on'
for:
minutes: 5
condition:
- condition: template
value_template: "{{ states('climate.downstairs') == 'off' }}"
action:
- service: climate.turn_on
data:
entity_id: climate.downstairs
#-------------------------------------------#-------------------------------------------
- alias: 'Alarm lights in Living room'
id: fd0a2b68-ce3c-4f14-849d-8a312a79335e
trigger:
- platform: state
entity_id:
- group.entry_points
- platform: state
entity_id: group.garage_doors
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: group.bed
state: 'off'
# action:
# - choose:
# - conditions:
# - condition: state
# entity_id: group.entry_points
# state: on
#
# sequence:
# - service: script.siren
# data:
# duration: 60
# - service: light.turn_on
# entity_id: all
action:
- choose:
- conditions: >
{{ states.group.entry_points.state == 'on' or
states.group.garage_doors.state != 'closed' }}
sequence:
- service: scene.turn_on
entity_id: scene.Red_living_Room
default:
- service: scene.turn_on
entity_id: scene.tv_time
# - service: >-
# {% if states.group.entry_points.state == 'on' or states.group.garage_doors.state != 'closed' -%}
# light.turn_on
# entity_id:
# - light.living_room_accents
# color_name: 'red'
# {% else %}
# light.turn_on
# entity_id:
# - light.living_room_accents
# color_name: 'gold'
# {% endif %}
#-------------------------------------------#---
- alias: "Panel Door opened"
id: 62d10d70-8092-4daa-9dcb-ed2bec6c6194
trigger:
- platform: state
entity_id:
- binary_sensor.MCU3_Light
to: 'off'
from: 'on'
action:
- service: script.notify_engine
data:
value1: 'Someone has opened up the Alarm Panel Door!'
who: 'carlo'
group: 'information'