-
Notifications
You must be signed in to change notification settings - Fork 17
/
Alarm.yaml
executable file
·773 lines (738 loc) · 27.1 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
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
- alias: 'Alarm - Trigger while armed away'
id: alarm_-_trigger_while_armed_away
initial_state: true
trigger:
- platform: state
entity_id:
- binary_sensor.conservatory_skylight_left
- binary_sensor.conservatory_single_door
- binary_sensor.conservatory_double_door
- binary_sensor.living_room_right_big_window
- binary_sensor.living_room_right_small_window
- binary_sensor.master_bedroom_right_big_window
- binary_sensor.master_bedroom_left_big_window
- binary_sensor.cloakroom_window
- binary_sensor.bathroom_window
- binary_sensor.kiaan_big_window
- binary_sensor.kiaan_small_window
- binary_sensor.blue_room_big_window
- binary_sensor.blue_room_small_window
- binary_sensor.main_door
- binary_sensor.kitchen_window
to: 'on'
condition:
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_away
- condition: or
conditions:
- condition: template
value_template: >
{%- set pirs = [
states.binary_sensor.conservatory_single_door,
states.binary_sensor.conservatory_double_door,
states.binary_sensor.living_room_right_big_window,
states.binary_sensor.living_room_right_small_window,
states.binary_sensor.master_bedroom_right_big_window,
states.binary_sensor.master_bedroom_left_big_window,
states.binary_sensor.cloakroom_window,
states.binary_sensor.bathroom_window,
states.binary_sensor.kiaan_big_window,
states.binary_sensor.kiaan_small_window,
states.binary_sensor.blue_room_big_window,
states.binary_sensor.blue_room_small_window,
states.binary_sensor.kitchen_window,
states.binary_sensor.main_door ] -%}
{%- set pirs_on = pirs | selectattr('state','eq','on') | list -%}
{{ ((pirs_on | length) | int ) >= 1}}
- condition: template
value_template: >
{%- set pirs = [
states.binary_sensor.pir_conservatory,
states.binary_sensor.pir_kitchen,
states.binary_sensor.pir_living_room_front,
states.binary_sensor.pir_living_room_back,
states.binary_sensor.pir_staircase] -%}
{%- set pirs_on = pirs | selectattr('state','eq','on') | list -%}
{{ ((pirs_on | length) | int ) > 1}}
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarm
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: '1'
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Alarm-CountDown.mp3'
media_content_type: 'audio/mp3'
- alias: 'Alarm - Alarm Triggered'
id: alarm_-_alarm_triggered
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'triggered'
action:
- parallel:
- service: xiaomi_aqara.play_ringtone
data:
gw_mac: 7811dcdae94a
ringtone_id: 2
ringtone_vol: 100
# play alert, 0.9 on onkyo, 1 on conservatory, google minis
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: 0.9
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Alarm-Intrusion.mp3'
media_content_type: 'audio/mp3'
- service: switch.turn_off
data:
entity_id: switch.kerui_alarm
- service: switch.turn_off
data:
entity_id: switch.kerui_alarm
- service: camera.snapshot
data:
entity_id: camera.fire7
filename: '/config/www/CCTV_Snapshots/Fire7.jpg'
- service: camera.snapshot
data:
entity_id: camera.front
filename: '/config/www/CCTV_Snapshots/Front.jpg'
- service: camera.snapshot
data:
entity_id: camera.side
filename: '/config/www/CCTV_Snapshots/Side.jpg'
- service: camera.snapshot
data:
entity_id: camera.back
filename: '/config/www/CCTV_Snapshots/Back.jpg'
- service: camera.snapshot
data:
entity_id: camera.kitchen
filename: '/config/www/CCTV_Snapshots/Kitchen.jpg'
- service: camera.snapshot
data:
entity_id: camera.living_room
filename: '/config/www/CCTV_Snapshots/LivingRoom.jpg'
- service: camera.snapshot
data:
entity_id: camera.conservatory
filename: '/config/www/CCTV_Snapshots/Conservatory.jpg'
- service: camera.snapshot
data:
entity_id: camera.garage
filename: '/config/www/CCTV_Snapshots/Garage.jpg'
- service: camera.snapshot
data:
entity_id: camera.doorbell
filename: '/config/www/CCTV_Snapshots/Doorbell.jpg'
- service: script.turn_on
data:
entity_id: script.alarm_flash_ligthts
- parallel:
- service: notify.twillio_lolo
data:
target: '{{states("sensor.twillio_lolo_number")}}'
title: "HA - Alarm Triggered !"
message: >
ALARM! ALARM! ALARM! The alarm has been triggered ! Please check your email for CCTV Pictures.
The alarm has been triggered ! Please check your email for CCTV Pictures.
- service: notify.twillio_lolo
data:
target: '{{states("sensor.twillio_div_number")}}'
title: "HA - Alarm Triggered !"
message: >
ALARM! ALARM! ALARM! The alarm has been triggered ! Please check your email for CCTV Pictures.
The alarm has been triggered ! Please check your email for CCTV Pictures.
- service: notify.gmaillolo
data:
title: "HA - Alarm Triggered !"
message: >
ALARM! The alarm has been triggered !(
({% for windoor in state_attr("group.door_and_window_sensors","entity_id")|list -%}
{% if is_state(windoor,"on") %}{{state_attr(windoor, "friendly_name")}}, {% endif %}
{%- endfor -%}
{% if is_state('binary_sensor.main_door','on') %}Main Door,{% endif%}
{% for mypirs in state_attr("group.pirs","entity_id")|list -%}
{% if is_state(mypirs ,"on") %}{{state_attr(mypirs , "friendly_name")}}, {% endif %}
{%- endfor %})
data:
images:
- /config/www/CCTV_Snapshots/LivingRoom.jpg
- /config/www/CCTV_Snapshots/Kitchen.jpg
- /config/www/CCTV_Snapshots/Conservatory.jpg
- /config/www/CCTV_Snapshots/Fire7.jpg
- /config/www/CCTV_Snapshots/Front.jpg
- /config/www/CCTV_Snapshots/Side.jpg
- /config/www/CCTV_Snapshots/Back.jpg
- /config/www/CCTV_Snapshots/Garage.jpg
- /config/www/CCTV_Snapshots/Doorbell.jpg
- service: notify.gmaildiv
data:
title: "Alarm Triggered !"
message: >
ALARM! The alarm has been triggered !(
({% for windoor in state_attr("group.door_and_window_sensors","entity_id")|list -%}
{% if is_state(windoor,"on") %}{{state_attr(windoor, "friendly_name")}}, {% endif %}
{%- endfor -%}
{% if is_state('binary_sensor.main_door','on') %}Main Door,{% endif%}
{% for mypirs in state_attr("group.pirs","entity_id")|list -%}
{% if is_state(mypirs ,"on") %}{{state_attr(mypirs , "friendly_name")}}, {% endif %}
{%- endfor %})
data:
images:
- /config/www/CCTV_Snapshots/LivingRoom.jpg
- /config/www/CCTV_Snapshots/Kitchen.jpg
- /config/www/CCTV_Snapshots/Conservatory.jpg
- /config/www/CCTV_Snapshots/Fire7.jpg
- /config/www/CCTV_Snapshots/Front.jpg
- /config/www/CCTV_Snapshots/Side.jpg
- /config/www/CCTV_Snapshots/Back.jpg
- /config/www/CCTV_Snapshots/Garage.jpg
- /config/www/CCTV_Snapshots/Doorbell.jpg
- service: notify.mobile_app_lolo_iphone
data:
message: "Alarm Triggered !"
data:
image: '{{states("input_text.base_url")}}/local/Alarm_Icon.png'
push:
interruption-level: critical
- service: notify.mobile_app_div_iphone
data:
message: "Alarm Triggered !"
data:
image: '{{states("input_text.base_url")}}/local/Alarm_Icon.png'
push:
interruption-level: critical
- wait_template: '{{ states("alarm_control_panel.alarm").split("_")[0] != "triggered"}}'
timeout: '00:15:00'
- service: media_player.media_stop
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: light.turn_off
entity_id: light.aqara_gateway_light
- service: light.turn_off
entity_id: light.wled_conservatory
- service: light.turn_off
entity_id: light.staircase_led_strip
- service: light.turn_off
entity_id: light.tv_cabinet_led_strip
- service: light.turn_off
entity_id: light.house_number
- service: light.turn_off
entity_id: light.kiaan_lamp
- alias: 'Alarm - Arming when windows left open'
id: alarm_-_arming_when_windows_left_open
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'arming'
from: 'disarmed'
condition:
- condition: state
entity_id: group.door_and_window_sensors
state: 'on'
action:
- service: tts.google_say
data:
entity_id: media_player.google_home_minis
message: |
Please note, the following doors or windows are not closed:
{% for windoor in state_attr("group.door_and_window_sensors","entity_id")|list -%}
{% if is_state(windoor,"on") %}{{state_attr(windoor, "friendly_name")}}, {% endif %}
{%- endfor -%}
{% if is_state('binary_sensor.main_door','on') %}Main Door,{% endif%}
The alarm is still being armed !
- service: notify.mobile_app_lolo_iphone
data:
message: |
The {% for windoor in state_attr("group.door_and_window_sensors","entity_id")|list -%}
{% if is_state(windoor,"on") %}{{state_attr(windoor, "friendly_name")}}, {% endif %}
{%- endfor -%}
{%- if is_state('binary_sensor.main_door','on') -%}Main Door,{%- endif -%}
are not closed.
The alarm is still being armed !
- service: notify.mobile_app_div_iphone
data:
message: |
The {% for windoor in state_attr("group.door_and_window_sensors","entity_id")|list -%}
{% if is_state(windoor,"on") %}{{state_attr(windoor, "friendly_name")}}, {% endif %}
{%- endfor -%}
{%- if is_state('binary_sensor.main_door','on') -%}Main Door,{%- endif -%}
are not closed.
The alarm is still being armed !
- wait_template: "{{ states('media_player.google_home_minis') != 'playing' }}"
timeout: '00:00:30'
continue_on_timeout: true
# - delay:
# seconds: 5
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Alarm-CountDown.mp3'
# - wait_template: "{{ is_state('binary_sensor.main_door', 'off') }}"
# timeout: '00:00:30'
# continue_on_timeout: true
- condition: template
value_template: '{{ states("alarm_control_panel.alarm")=="arming" }}'
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/1sec.mp3'
media_content_type: 'audio/mp3'
- service: script.turn_on
data:
entity_id: script.flash_aqara_light
- alias: 'Alarm - Arming'
id: alarm_-_pending_arming
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'arming'
from: 'disarmed'
action:
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: 1
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Alarm-CountDown.mp3'
media_content_type: 'audio/mp3'
- wait_template: "{{ is_state('binary_sensor.main_door', 'on') }}"
timeout: '00:00:30'
continue_on_timeout: true
- wait_template: "{{ is_state('binary_sensor.main_door', 'off') }}"
timeout: '00:00:30'
continue_on_timeout: true
- condition: template
value_template: '{{ states("alarm_control_panel.alarm")=="arming" }}'
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/1sec.mp3'
media_content_type: 'audio/mp3'
- service: script.turn_on
data:
entity_id: script.flash_aqara_light
- alias: 'Alarm - Pending Siren'
id: alarm_-_pending_siren
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'pending'
from: 'armed_away'
- platform: state
entity_id: alarm_control_panel.alarm
to: 'pending'
from: 'armed_home'
action:
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: '1'
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Alarm-CountDown.mp3'
media_content_type: 'audio/mp3'
- service: script.turn_on
data:
entity_id: script.flash_aqara_light
- alias: 'Alarm - Disarming'
id: alarm_-_disarming
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'disarmed'
action:
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: switch.turn_on
data:
entity_id: switch.kerui_disarm
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Armed_Disarmed.mp3'
media_content_type: 'audio/mp3'
- service: media_player.volume_set
data:
entity_id: media_player.onkyo_tx_nr656_zone_2
volume_level: 0.6
- service: light.turn_off
data:
entity_id: light.aqara_gateway_light
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: '{% if as_timestamp(now()) | timestamp_custom("%-H") | float >= 7 and as_timestamp(now()) | timestamp_custom("%-H") | float < 20 %} 0.75 {% else %} 0.5 {% endif %}'
- service: media_player.turn_off
entity_id: media_player.panasonic_viera_tv
- service: media_player.turn_off
entity_id: media_player.onkyo_tx_nr656
- service: media_player.volume_set
data:
entity_id: media_player.google_home_minis
volume_level: 0.5
- alias: 'Alarm - Armed'
id: alarm_-_armed
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'armed_away'
- platform: state
entity_id: alarm_control_panel.alarm
to: 'armed_home'
action:
- service: media_player.play_media
data:
entity_id: media_player.google_home_minis
media_content_id: 'http://192.168.9.23:8123/local/sounds/Armed_Disarmed.mp3'
media_content_type: 'audio/mp3'
- service: light.turn_on
data:
entity_id: light.aqara_gateway_light
brightness: 255
rgb_color: [255,0,0]
- alias: 'Alarm - Fire Alarm'
id: alarm_-_fire_alarm
initial_state: true
trigger:
- platform: state
entity_id:
- binary_sensor.ground_floor_smoke_detector
- binary_sensor.first_floor_smoke_detector
to: 'on'
action:
- parallel:
- service: camera.snapshot
data:
entity_id: camera.fire7
filename: '/config/www/CCTV_Snapshots/Fire7.jpg'
- service: camera.snapshot
data:
entity_id: camera.kitchen
filename: '/config/www/CCTV_Snapshots/Kitchen.jpg'
- service: camera.snapshot
data:
entity_id: camera.living_room
filename: '/config/www/CCTV_Snapshots/LivingRoom.jpg'
- service: camera.snapshot
data:
entity_id: camera.living_room
filename: '/config/www/CCTV_Snapshots/Conservatory.jpg'
- parallel:
- service: notify.twillio_lolo
data:
target: '{{states("sensor.twillio_lolo_number")}}'
title: "HA - Fire Alarm !"
message: >
ALARM! ALARM! ALARM! The fire alarm has been triggered ! Please check your email for CCTV Pictures.
The fire alarm has been triggered ! Please check your email for CCTV Pictures.
- service: notify.twillio_lolo
data:
target: '{{states("sensor.twillio_div_number")}}'
title: "HA - Fire Alarm !"
message: >
ALARM! ALARM! ALARM! The fire alarm has been triggered ! Please check your email for CCTV Pictures.
The fire alarm has been triggered ! Please check your email for CCTV Pictures.
- service: notify.gmaillolo
data:
title: "HA - Fire Alert"
message: >
FIRE ALARM! Smoke detected on the {{ state_attr(trigger.event.data.entity_id, 'friendly_name') }}
data:
images:
- /config/www/CCTV_Snapshots/LivingRoom.jpg
- /config/www/CCTV_Snapshots/Kitchen.jpg
- /config/www/CCTV_Snapshots/Conservatory.jpg
- /config/www/CCTV_Snapshots/Fire7.jpg
- service: notify.gmaildiv
data:
message: >
FIRE ALARM! Smoke detected on the {{ state_attr(trigger.event.data.entity_id, 'friendly_name') }}
data:
images:
- /config/www/CCTV_Snapshots/LivingRoom.jpg
- /config/www/CCTV_Snapshots/Kitchen.jpg
- /config/www/CCTV_Snapshots/Conservatory.jpg
- /config/www/CCTV_Snapshots/Fire7.jpg
- service: notify.mobile_app_lolo_iphone
data:
message: >
FIRE ALARM!({{ state_attr(trigger.event.data.entity_id, 'friendly_name') }})
data:
image: '{{states("input_text.base_url")}}/local/Fire_Icon.png'
push:
interruption-level: critical
- service: notify.mobile_app_div_iphone
data:
message: >
FIRE ALARM!({{ state_attr(trigger.event.data.entity_id, 'friendly_name') }})
data:
image: '{{states("input_text.base_url")}}/local/Fire_Icon.png'
push:
interruption-level: critical
- alias: 'Alarm - Start Charging Fire 7'
id: alarm_-_start_charging_fire_7
initial_state: true
trigger:
- platform: state
entity_id: sensor.fire7_battery
- platform: time_pattern
minutes: '/1'
seconds: 0
condition:
- condition: template
value_template: "{{ states('sensor.fire7_battery')|int < 45 }}"
- condition: state
entity_id: switch.fire7_charger
state: 'off'
action:
- service: switch.turn_on
data:
entity_id: switch.fire7_charger
- alias: 'Alarm - Stop Charging Fire 7'
id: alarm_-_stop_charging_fire_7
initial_state: true
trigger:
- platform: state
entity_id: sensor.fire7_battery
- platform: time_pattern
minutes: '/1'
seconds: 0
condition:
- condition: template
value_template: "{{ states('sensor.fire7_battery')|int > 85 }}"
- condition: state
entity_id: switch.fire7_charger
state: 'on'
action:
- service: switch.turn_off
data:
entity_id: switch.fire7_charger
- alias: 'Alarm - Switch everything off when we leave home'
id: alarm_-_switch_everything_off_when_we_leave_home
initial_state: true
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: 'armed_away'
condition:
- condition: state
entity_id: input_boolean.guests
state: 'off'
action:
- service: media_player.turn_off
entity_id: media_player.kitchen
- service: media_player.turn_off
entity_id: media_player.onkyo_tx_nr656
- service: media_player.turn_off
entity_id: media_player.conservatory
- service: media_player.turn_off
entity_id: media_player.house
- service: media_player.turn_off
entity_id: media_player.downstairs
- service: input_boolean.turn_on
entity_id: input_boolean.silent
- service: input_boolean.turn_off
entity_id: input_boolean.normal
- service: light.turn_off
data:
entity_id: group.interior_lights
- service: light.turn_off
data:
entity_id: light.living_room_main
- service: input_boolean.turn_on
entity_id: input_boolean.normal
- service: input_boolean.turn_off
entity_id: input_boolean.silent
- alias: 'Alarm - Re-arm Alarm after unplanned reboot'
id: alarm_-_re-arm_alarm_after_unplanned_reboot
initial_state: true
trigger:
- platform: homeassistant
event: start
action:
- delay:
seconds: 2
- condition: state
entity_id: light.aqara_gateway_light
state: 'on'
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.alarm
data:
code: !secret alarm_code
- alias: Alarm - Remote Arm
id: alarm_-_remote_arm
initial_state: true
trigger:
- platform: event
event_type: button_pressed
event_data:
entity_id: switch.kerui_remote_lock
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.alarm
data:
code: !secret alarm_code
- alias: Alarm - Remote Disarm
id: alarm_-_remote_disarm
initial_state: true
trigger:
- platform: event
event_type: button_pressed
event_data:
entity_id: switch.kerui_remote_unlock
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.alarm
data:
code: !secret alarm_code
- alias: Alarm - Notify to Arm when leaving home unarmed
id: alarm_-_notify_to_arm_when_leaving_home_unarmed
initial_state: true
trigger:
- platform: state
entity_id: person.div
from: "home"
- platform: state
entity_id: person.laurent
from: "home"
condition:
- condition: state
entity_id: input_boolean.guests
state: 'off'
- condition: template
value_template: "{{ states('alarm_control_panel.alarm') == 'disarmed' }}"
action:
- delay:
minutes: 2
- condition: template
value_template: '{{ states("person.laurent") != "home" and states("person.div") != "home"}}'
- service: notify.mobile_app_lolo_iphone
# data:
# message: 'The alarm has not been armed !'
# data:
# push:
# badge: '{{states("counter.iosbadgecount")}}'
# category: "armalarm"
# action_data:
# entity_id: alarm_control_panel.alarm
data:
message: "The alarm has not been armed !"
data:
actions:
- action: "ARM_ALARM"
title: "Arm Alarm"
destructive: yes
- service: notify.mobile_app_div_iphone
# data:
# message: 'The alarm has not been armed !'
# data:
# push:
# badge: '{{states("counter.iosbadgecount")}}'
# category: "armalarm"
# action_data:
# entity_id: alarm_control_panel.alarm
data:
message: "The alarm has not been armed !"
data:
actions:
- action: "ARM_ALARM"
title: "Arm Alarm"
destructive: yes
- alias: Alarm - Arm Alarm from iOS Notification
id: alarm_-_arm_alarm_from_ios_notification
initial_state: true
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: ARM_ALARM
- platform: event
event_type: mobile_app_notification_action
event_data:
action: ARM_ALARM
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.alarm
data:
code: !secret alarm_code
- alias: Alarm - DisArm Alarm from iOS Notification
id: alarm_-_disarm_alarm_from_ios_notification
initial_state: true
trigger:
- platform: event
event_type: ios.action_fired
event_data:
actionName: DISARM_ALARM
- platform: event
event_type: mobile_app_notification_action
event_data:
action: DISARM_ALARM
action:
- service: alarm_control_panel.alarm_disarm
entity_id: alarm_control_panel.alarm
data:
code: !secret alarm_code
- alias: Alarm - DisArm Alarm when reaching home from iOS Notification (Yale Unlocked)
id: alarm_-_disarm_alarm_when_reaching_home_from_ios_notification
initial_state: true
trigger:
- platform: state
entity_id: person.laurent
to: "home"
- platform: state
entity_id: person.div
to: "home"
condition:
- condition: template
value_template: '{{ states("alarm_control_panel.alarm") != "disarmed" }}'
- condition: template
value_template: '{{states("lock.yale_conexis_l1_lock") == "unlocked"}}'
- condition: template
value_template: '{{ (as_timestamp(now()) - as_timestamp(state_attr("automation.alarm_disarm_alarm_when_reaching_home_from_ios_notification", "last_triggered")) | int > 60)}}'
action:
- service: '{% if trigger.entity_id == "person.laurent" %}notify.mobile_app_lolo_iphone{% else %}notify.mobile_app_div_iphone{% endif %}'
# data:
# message: 'Disarm alarm ?'
# data:
# push:
# badge: '{{states("counter.iosbadgecount")}}'
# category: "disarmalarm"
# action_data:
# entity_id: alarm_control_panel.alarm
data:
message: "Disarm alarm ?"
data:
image: '{{states("input_text.base_url")}}/local/Alarm_Icon.png'
actions:
- action: "DISARM_ALARM"
title: "Disarm Alarm"
destructive: yes