/
security.yaml
executable file
·1225 lines (1169 loc) · 41.6 KB
/
security.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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################################
# @author : Jeffrey Stone
# @date : 03/13/2019
# @package : Security
# @description : Everything related to security functions.
###############################################################################
input_boolean:
# Main security switch. If this is on, the security is armed.
sentry_mode:
name: Sentry Mode
icon: mdi:security
# Vacation mode is automagically set when we are 3 hours from the house, and turns off when we return.
# This is used to modify some of the normal automations.
vacation_mode:
name: Vacation Mode
icon: mdi:airplane-takeoff
# Guest mode is use to modify autoamtions when we have guests.
# In some cases this prevents security from being set to prevent security alarm going off
guest_mode:
name: Guest Mode
icon: mdi:account-multiple
# This switch powers the security alarm and gives an easy way to kill the alarm.
# When it is on, the alarm is going off
security_alarm:
name: Security Alarm
icon: mdi:speaker-wireless
# This switch powers the fire alarm.
# When on the fire alarm is going off.
fire_alarm:
name: Fire Alarm
icon: mdi:speaker-wireless
# This switch turns on if the garage is open after dark and triggers the garage_after_dark alert.
garage_after_dark:
name: Garage Open After Dark
icon: mdi:message-alert
# This switch turns on of the security system checks that fire when someone tries to arm the system
# finds a door open, or another condition that would prevent the system from being able to monitor properly.
lockdown_issue:
name: Lockdown Issue
icon: mdi:lock-reset
# This switch is turned on if there is a security breach. Turning on this switch starts the countdown to the alarm.
security_issue:
name: Security Issue
icon: mdi:alert-circle-outline
# Dog Mode is triggered when Home Assistant believes someone is about to open the back door to let
# to let the dog out in the midddle of the night.
# https://slacker-labs.com/2020/04/14/where-we-are-going-we-need-dog-mode/
dog_mode:
name: Dog Mode
icon: mdi:dog-side
sensor:
- platform: authenticated
- platform: mqtt
name: front_door_motion_away_count
state_topic: "house/front_door_motion/away_count"
automation:
#############################################
# When sentry mode is enabled / security armed by any method, check the doors and notify everyone.
- id: sentry_mode_enabled
alias: Sentry Mode Enabled Annoucement
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.sentry_mode
from: "off"
to: "on"
action:
- choose:
- conditions:
- condition: state
entity_id: group.external_doors
state: "on"
sequence:
- service: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
- service: input_boolean.turn_on
entity_id: input_boolean.lockdown_issue
- service: script.text_notify
data:
who: "parents"
message: "Unable to lock down Anchorage House due to issue"
- service: script.speech_engine
data_template:
who: "{{ states.sensor.room_audio.state }}"
message: >
{{ [
"I was unable to activate barn door protocol due to an open door.",
"You may want to check the external doors. I was unable to secure them all.",
"My systems check has failed. Please check the external doors.",
"Someone has left the pod bay doors open."
] | random }}
default:
- service: script.speech_engine
data_template:
who: "{{ states.sensor.room_audio.state }}"
message: >
{{ [
"Barn door protocol has been activated.",
"Anchorage House has been secured! ",
"Sentry Mode is active. ",
"I am now monitoring the doors and will let you know if anyone attempts to access.",
"Anchorage House Shields are up."
] | random }}
- service: script.text_notify
data_template:
who: "parents"
title: "Security Armed"
message: "Security System has been armed."
- service: alarm_control_panel.aarlo_set_mode
data:
entity_id: alarm_control_panel.aarlo_ah_base_station
mode: "Armed"
- service: media_player.play_media
target:
device_id: edb192da8c7f80c32410147961257fae
data:
media_content_id: disarm easy viz
media_content_type: routine
- service: script.turn_on
entity_id: script.reset_front_door_motion_count
# When sentry mode is disabled / security disarmed by any method, notify everyone.
- id: sentry_mode_disabled
alias: Sentry Mode Disabled Annoucement
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.sentry_mode
from: "on"
to: "off"
action:
- choose:
- conditions:
condition: or
conditions:
- condition: state
entity_id: group.family
state: "home"
- condition: state
entity_id: input_boolean.guest_mode
state: "on"
sequence:
- service: script.speech_engine
data_template:
who: "{{ states.sensor.room_audio.state }}"
message: >
{{ [
"Barn door protocol has been deactivated.",
"I am no longer monitoring the access points. ",
"Sentry Mode has been disabled. ",
"Anchorage House Shields are down."
] | random }}
- service: script.text_notify
data_template:
who: "parents"
title: "Welcome Home"
message: "Security System has been disarmed."
- service: alarm_control_panel.aarlo_set_mode
data:
entity_id: alarm_control_panel.aarlo_ah_base_station
mode: "home"
- service: input_boolean.turn_off
entity_id: input_boolean.security_alarm
default:
- service: input_boolean.turn_off
entity_id: input_boolean.sentry_mode
- service: script.text_notify
data_template:
who: "parents"
title: "Potential Security Issue"
message: "Security System has been disarmed, but I could not validate presence."
- service: alarm_control_panel.aarlo_set_mode
data:
entity_id: alarm_control_panel.aarlo_ah_base_station
mode: "home"
#############################################
#############################################
# Scheduled Arm / Disarm
# Disarm around the time people are up
- id: morning_standby
alias: Morning Standby
initial_state: true
trigger:
- platform: time
at: 05:30:00
condition:
condition: or
conditions:
- condition: state
entity_id: group.family
state: "home"
- condition: state
entity_id: input_boolean.guest_mode
state: "on"
action:
- service: script.standby
# Secure the house every night if it has been set already, and everyone is home.
- id: nightly_lockdown
alias: Nightly Lockdown
initial_state: true
trigger:
- platform: time
at: "23:00:00"
condition:
- condition: state
entity_id: person.jeffrey
state: home
- condition: state
entity_id: person.katherine
state: home
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: state
entity_id: input_boolean.sentry_mode
state: "off"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.sentry_mode
#############################################
#############################################
# Vacation Mode Enabled
# Enable when everyone is 3 hours away.
# Disbaled happens in family_is_home automation in presence.yaml
- id: enable_vacation_mode
alias: Enable Vacation Mode
initial_state: true
trigger:
- platform: numeric_state
entity_id: sensor.jeff_ett_home
above: 180
- platform: numeric_state
entity_id: sensor.kat_ett_home
above: 180
condition:
- condition: numeric_state
entity_id: sensor.jeff_ett_home
above: 180
- condition: numeric_state
entity_id: sensor.kat_ett_home
above: 180
action:
- service: input_boolean.turn_on
entity_id: input_boolean.vacation_mode
#############################################
#############################################
# Dog Mode
#
# Activate Dog Mode
# If done via motion annouce in kitchen. If manually just text.
- id: dog_mode_activated
alias: Dog Mode Activated
mode: single
trigger:
- platform: state
entity_id: binary_sensor.back_door_motion
to: "on"
- platform: state
entity_id: input_boolean.dog_mode
to: "on"
action:
- choose:
- conditions:
- condition: template
value_template: '{{ trigger.to_state.attributes.friendly_name == "Dog Mode" }}'
sequence:
- service: script.text_notify
data:
who: "parents"
message: "Dog Mode has been enabled manually"
- conditions:
- condition: state
entity_id: input_boolean.sentry_mode
state: "on"
- condition: state
entity_id: group.family
state: "home"
sequence:
- service: input_boolean.turn_on
entity_id: input_boolean.dog_mode
- service: script.jarvis_alert
data_template:
who: kitchen
message: "Turning on Dog Mode."
- conditions:
- condition: state
entity_id: input_boolean.sentry_mode
state: "on"
- condition: state
entity_id: group.family
state: "not_home"
- condition: state
entity_id: input_boolean.vacation_mode
state: "off"
sequence:
- service: script.text_alert
data:
who: parents
message: "Winston may be trying to go out and no one appears to be here to let him out."
- service: script.dog_mode_lighting_on
- delay:
minutes: 20
- service: input_boolean.turn_off
entity_id: input_boolean.dog_mode
# After 20, minutes deactivate dog mode
- id: dog_mode_deactivated
alias: Dog mode Deactivated
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.dog_mode
to: "off"
action:
- service: script.text_notify
data:
who: "jeff"
message: "Dog Mode has been disabled"
- service: scene.turn_on
entity_id: scene.kitchen_lightning_off
#############################################
#############################################
# Garage Monitoring
# If garage is opens when sun is below horion turn on drivway lights.
- id: garage_opened_night
alias: Garage Opened at Night
trigger:
- platform: state
entity_id: group.garage_doors
from: "off"
to: "on"
condition:
- condition: state
entity_id: sun.sun
state: below_horizon
action:
- service: script.driveway_on
initial_state: true
# If garage is open at sunset turn on driveway lights.
- id: garage_open_sunset
alias: Garage Open At Sunset
initial_state: true
trigger:
- platform: sun
event: sunset
condition:
- condition: state
entity_id: binary_sensor.garage_door
state: "on"
action:
- service: script.driveway_on
# If garage doors are closed kick off script to turn them off, and turn off alert.
- id: garage_closed
alias: Garage Closed
trigger:
- platform: state
entity_id: group.garage_doors
from: "on"
to: "off"
action:
- service: script.driveway_off
- service: input_boolean.turn_off
data:
entity_id: input_boolean.garage_after_dark
initial_state: true
# If garage is still open at 10:30pm turn on alart to make sure it get closed.
- id: close_garage_lights_out
alias: Close Garage at lights out
initial_state: true
trigger:
- platform: time
at: "22:30:00"
condition:
- condition: state
entity_id: binary_sensor.garage_door
state: "on"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.garage_after_dark
#############################################
#############################################
# Normal Notifications
# Door chime when doors are open to make sure we know when people are coming/going
- id: door_notifications
alias: Door Notifications
trigger:
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
to: "on"
id: chime
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.laundry_room_door
- binary_sensor.attic_door
- binary_sensor.back_door
from: "off"
to: "on"
for: "00:01:00"
id: door_still_open
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.audible_notifications
state: "on"
- condition: state
entity_id: input_boolean.guest_mode
state: "off"
- condition: or
conditions:
- condition: state
entity_id: media_player.ha_blue
state: "idle"
- condition: state
entity_id: media_player.ha_blue
state: "off"
action:
- choose:
- conditions:
- condition: trigger
id: chime
sequence:
- service: media_player.turn_on
entity_id: media_player.ha_blue
- service: media_player.volume_set
data_template:
entity_id: media_player.ha_blue
volume_level: .12
- service: media_player.play_media
entity_id: media_player.ha_blue
data:
media_content_id: /media/sounds/door_open.wav
media_content_type: "music"
- conditions:
- condition: trigger
id: door_still_open
sequence:
- service: script.speech_engine
data:
who: "{{ states.sensor.room_audio.state }}"
message: >
The {{ trigger.to_state.attributes.friendly_name }}
{{ [
' is standing open.',
' is open.',
' does not close on its own.',
' was left standing open.'
] | random }}
{{ [
'Can a human be so kind and close it?',
'The air quality in this house has actually improved.',
'Closing the door would improve the internal climate of the house.',
'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.',
'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.',
'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.',
'I would close it for you. But I lack legs. And Arms.'
] | random }}
initial_state: true
# # If door is open too long play message and identify open door.
# - id: door_opened_long
# alias: Door Opened Too Long
# trigger:
# - platform: state
# entity_id:
# - binary_sensor.front_door
# - binary_sensor.laundry_room_door
# - binary_sensor.attic_door
# - binary_sensor.back_door
# from: 'off'
# to: 'on'
# for: '00:01:00'
# condition:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# action:
# - service: script.speech_engine
# data_template:
# who: '{{ states.sensor.room_audio.state }}'
# message: >
# The {{ trigger.to_state.attributes.friendly_name }}
# {{ [
# ' is standing open.',
# ' is open.',
# ' does not close on its own.',
# ' was left standing open.'
# ] | random }}
# {{ [
# 'Can a human be so kind and close it?',
# 'The air quality in this house has actually improved.',
# 'Closing the door would improve the internal climate of the house.',
# 'Hey. The door was just opened and this is crazy. But now you know. So close it maybe.',
# 'If at first you do not succeed in closing the door, please try again. Like, Right now seems like a good time to try again.',
# 'And the automatic door closer appears to be broken. So, you know what to do. Time to get physical.',
# 'I would close it for you. But I lack legs. And Arms.'
# ] | random }}
# initial_state: true
# If guest mode is enabled, notify the house
- id: guest_mode_feedback
alias: Guest Mode Audio Feedback
trigger:
- platform: state
entity_id:
- input_boolean.guest_mode
from: "off"
to: "on"
action:
- service: script.speech_engine
data_template:
who: "{{ states.sensor.room_audio.state }}"
message: >
{{ [
"Guest Mode has been enabled.",
"I have switched to the system to guest mode.",
"I have enabled guest mode. ",
"Guest Mode is on."
] | random }}
# If sentry mode is on / Security armed, notify when there is movement around doors.
- id: motion_detected_front_door
alias: Motion Detected Front Door
trigger:
- platform: state
entity_id: binary_sensor.aarlo_motion_front_door
from: "off"
to: "on"
action:
- service: image_processing.scan
entity_id: image_processing.doods_aarlo_front_door
- choose:
- conditions:
- condition: template
value_template: '{{ states("image_processing.doods_aarlo_front_door") | int > 0 }}'
sequence:
- service: mqtt.publish
data:
topic: house/front_door_motion/away_count
payload_template: "{{ states.sensor.front_door_motion_away_count.state | int + 1 }}"
retain: true
- service: script.status_annc
data:
who: "{{ states.sensor.room_presence.state }}"
call_interuption: 1
call_snark_door_motion: 1
speech_message: >
{{ [
"I have detected someone at the ",
"Someone appears to be at the ",
"There is a person at the ",
"My sensors are picking up presence at the ",
"We appear to have a visitor at the ",
"My sensors have detected a meat popsicle at the "
] | random }}
{{ trigger.to_state.attributes.friendly_name }}.
- delay:
minutes: 2
initial_state: true
#############################################
#############################################
# Security Issues
# If doors are opened and sentry mode is on / security armed announce location of breach to house and turn on security issue.
# If its the back door and dog mode is on ignore
- id: security_breach_door
alias: Security Breach Doors
trigger:
- platform: state
entity_id:
- binary_sensor.front_door
- binary_sensor.back_door
- binary_sensor.side_door
- binary_sensor.garage_door
to: "on"
condition:
- condition: state
entity_id: input_boolean.sentry_mode
state: "on"
action:
- choose:
- conditions:
- condition: template
value_template:
'{{ trigger.to_state.attributes.friendly_name == "Back Door"
}}'
- condition: state
entity_id: input_boolean.dog_mode
state: "on"
sequence:
- service: script.text_notify
data:
who: "jeff"
message: "Dog Mode enabled, bypassing back door sensor."
default:
- service: script.jarvis_alert
data_template:
message: "My security protocols are being overidden,, The {{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: script.text_alert
data:
who: parents
title: "Security Alert!!"
message: "{{ trigger.to_state.attributes.friendly_name }} has been opened."
- service: input_boolean.turn_on
entity_id: input_boolean.security_issue
initial_state: true
# If security issue switch turns on, kick off security response script, and go red.
- id: security_response_on
alias: Security Response On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.security_issue
from: "off"
to: "on"
for: 00:02:00
action:
- service: script.turn_on
entity_id: script.security_response
- service: scene.turn_on
entity_id: scene.lr_red
# If security issue is turned off, cancel response.
- id: security_response_off
alias: Security Response Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.security_issue
from: "on"
to: "off"
action:
- service: script.turn_off
entity_id: script.security_response
- service: media_player.media_stop
entity_id: media_player.ha_blue
- service: input_boolean.turn_off
entity_id: input_boolean.security_alarm
- service: scene.turn_on
entity_id: scene.normal_livingroom_lighting
- service: script.text_alert
data:
who: parents
message: "Security Issue Cleared! Canceling Repsonse."
# Security alarm is turned on, lets make it loud.
- id: security_alarm_on
alias: Security alarm On
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.security_alarm
to: "on"
action:
- service: script.turn_on
entity_id: script.notification_security_alarm_audio
# Security alarm turned off so concert is over.
- id: security_alarm_off
alias: Security alarm Off
initial_state: true
trigger:
- platform: state
entity_id: input_boolean.security_alarm
to: "off"
action:
- service: script.turn_off
entity_id: script.notification_security_alarm_audio
- service: media_player.media_stop
entity_id: media_player.ha_blue
# If water leak is deteced near fridge, let everyone know.
- id: water_leak_detected
alias: Welcome Home
trigger:
- platform: state
entity_id:
- binary_sensor.0x286d9700010c9f39_water_leak
from: "off"
to: "on"
action:
- service: script.text_notify
data_template:
who: "parents"
title: "Water Leak!!!!"
message: >
{% set location = trigger.to_state.attributes.friendly_name %}
location + has detected a leak
- service: script.jarvis_alert
data_template:
message: >
{% set location = trigger.to_state.attributes.friendly_name %}
{%- macro issue_report(location) -%}
{{ [
'I have detected an issue!',
'We have a problem!',
'You might not like this.',
'There is something that needs your attention.'
] | random }}
{{ [
location + " is detecting a leak.",
location + " has detected water.",
location + " is picking up water."
] | random }}
{%- endmacro -%}
{{issue_report(location)}}
#############################################
#############################################
# Fire alarm - Currently Disabled as I rework this
# - id: Kitchen_Alarm_Smoke
# alias: Kitchen Alarm Smoke
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.kitchen_smoke_detector
# to: 'smoke'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - Smoke
# message: Smoke Detected in Kitchen!!
# - service: script.jarvis_alert
# data_template:
# message: Smoke Detected in Kitchen!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Smoke Detected in Kitchen
# data:
# type: announce
# - id: Kitchen_Alarm_Co
# alias: Kitchen Alarm CO
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.kitchen_smoke_carbon_monoxide_detector
# to: 'co2'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - CO
# message: CO Detected in Kitchen!!
# - service: script.jarvis_alert
# data_template:
# message: Carbon Dioxide Detected in Kitchen!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Carbon Dioxide Detected in Garage
# data:
# type: announce
# - id: Garage_Alarm_Smoke
# alias: Garage Alarm Smoke
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.garage_smoke_smoke_detector
# to: 'smoke'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - Smoke
# message: Smoke Detected in Garage!!
# - service: script.jarvis_alert
# data_template:
# message: Smoke Detected in Garage!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Smoke Detected in Garage
# data:
# type: announce
# - id: Garage_Alarm_Co
# alias: Garage Alarm CO
# initial_state: true
# trigger:
# - platform: state
# entity_id: sensor.garage_smoke_carbon_monoxide_detector
# to: 'co2'
# action:
# - service: input_boolean.turn_on
# entity_id: input_boolean.fire_alarm
# - service: script.text_alert
# data_template:
# title: Security Alert - CO
# message: CO Detected in Garage!!
# - service: script.jarvis_alert
# data_template:
# message: Carbon dioxide Detected in Garage!
# - delay:
# seconds: 5
# - service: script.fire_alarm
# - delay:
# seconds: 15
# - service: notify.alexa_media_everywhere
# data:
# message: Carbon Dioxide Detected in Garage
# data:
# type: announce
#############################################
script:
driveway_doods:
sequence:
- service: image_processing.scan
entity_id: image_processing.doods_driveway
- repeat:
while:
- condition: template
value_template: '{{ states("image_processing.doods_driveway") | int > 0 }}'
sequence:
- service: script.text_alert_image
data:
who: jeff
title: Person Detected!
message: >
{{ states("image_processing.doods_driveway") | int}} people detected near vehicles
url: /media/images/driveway_latest.jpg
content_type: JPEG
- delay: 00:01:00
- service: image_processing.scan
entity_id: image_processing.doods_driveway
# backyard_doods:
# sequence:
# - service: image_processing.scan
# entity_id: image_processing.doods_driveway
# - repeat:
# while:
# - condition: template
# value_template: '{{ states("image_processing.doods_driveway") | int > 0 }}'
# sequence:
# - service: script.text_alert_image
# data:
# who: jeff
# title: Person Detected!
# message: >
# {{ states("image_processing.doods_driveway") | int}} people detected near vehicles
# url: /media/images/driveway_latest.jpg
# content_type: JPEG
# - delay: 00:01:00
# - service: image_processing.scan
# entity_id: image_processing.doods_driveway
theater_occupancy:
sequence:
- service: image_processing.scan
entity_id: image_processing.doods_theater_camera
- repeat:
while:
- condition: template
value_template: '{{ states("image_processing.doods_theater_camera") | int > 0 }}'
sequence:
- service: script.text_debug
data:
message: >
{{ states("image_processing.doods_theater_camera") | int}} people detected in Theater
- delay: 00:03:00
- service: image_processing.scan
entity_id: image_processing.doods_theater_camera
kitchen_occupancy:
sequence:
- service: image_processing.scan
entity_id: image_processing.doods_kitchen_camera
- repeat:
while:
- condition: template
value_template: '{{ states("image_processing.doods_kitchen_camera") | int > 0 }}'
sequence:
- service: script.text_debug
data:
message: >
{{ states("image_processing.doods_kitchen_camera") | int}} people detected in Kitchen
- delay: 00:03:00
- service: image_processing.scan
entity_id: image_processing.doods_kitchen_camera
livingroom_occupancy:
sequence:
- service: image_processing.scan
entity_id: image_processing.doods_livingroom_camera
- repeat:
while:
- condition: template
value_template: '{{ states("image_processing.doods_livingroom_camera") | int > 0 }}'
sequence:
- service: script.text_debug
data:
message: >
{{ states("image_processing.doods_livingroom_camera") | int}} people detected in Livingroom
- delay: 00:03:00
- service: image_processing.scan
entity_id: image_processing.doods_livingroom_camera
# door chime script, just plays sound anytime called.
# door_chime:
# sequence:
# - condition: state
# entity_id: input_boolean.audible_notifications
# state: 'on'
# - service: media_player.turn_on
# entity_id: media_player.ha_blue
# - service: media_player.volume_set
# data_template:
# entity_id: media_player.ha_blue
# volume_level: .5
# - service: media_player.play_media
# entity_id: media_player.ha_blue
# data:
# media_content_id: /media/sounds/door_open.wav
# media_content_type: "music"
# Play Fire alarm Siren
# fire_alarm:
# sequence:
# - condition: state
# entity_id: input_boolean.fire_alarm
# state: "on"
# - service: media_player.turn_on
# entity_id: media_player.ha_blue
# - service: media_player.volume_set
# data_template:
# entity_id: media_player.ha_blue
# volume_level: .75
# - service: media_player.play_media
# entity_id: media_player.ha_blue
# data:
# media_content_id: http://192.168.7.40/fire_alarm.mp3
# media_content_type: "music"
# Called when security is to be disarmed, clears any alarms or issues as well
standby:
sequence:
- service: script.turn_on
entity_id: script.vacation_canceled
- service: script.turn_on
entity_id: script.disarm_security
- service: script.turn_on
entity_id: script.cancel_security_alarm
- service: script.turn_on
entity_id: script.cancel_lockdown_issue
- service: script.turn_on
entity_id: script.clear_security_issue
# If vacation mode is on, turn it off
vacation_canceled:
sequence:
- condition: state
entity_id: input_boolean.vacation_mode
state: "on"
- data:
entity_id: input_boolean.vacation_mode
service: input_boolean.turn_off