-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHA automation
1635 lines (1459 loc) · 46.2 KB
/
HA automation
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
# https://companion.home-assistant.io/docs/notifications/notifications-basic/
https://community.home-assistant.io/t/return-light-to-previous-state-in-automation/309999/3
https://code.jnf.me/jaywll/home-automation
## This will notify if any doors are open it requires the [sensor.door_count] **it won't allow you to arm the alarm until all windows are closed**
# base_url: !secret base_url
https://community.home-assistant.io/t/automation-to-stop-media-player/405126/14
https://smarthomepursuits.com/how-to-arm-disarm-alarm-on-a-schedule-from-lovelace/
# - alias: Open Doors Notification On Alarm Set
# trigger:
# - platform: state
# entity_id: alarm_control_panel.ha_alarm
# to: pending
# condition:
# - condition: numeric_state
# above: '1'
# entity_id: sensor.door_count
# action:
# - service: tts.google_say
# data:
# entity_id: media_player.tts_kodi
# message: There are still doors open maybe you should close them first.
# - service: alarm_control_panel.alarm_disarm
#
# ## This will notify if any windows are open it requires the [sensor.window_count] **it won't allow you to arm the alarm until all windows are closed**
#
# - alias: Open Windows Notification on Alarm Set
# trigger:
# - platform: state
# entity_id: alarm_control_panel.ha_alarm
# to: pending
# condition:
# - condition: numeric_state
# above: '0'
# entity_id: sensor.window_count
# action:
# - delay: 00:00:20
# - service: tts.google_say
# data:
# entity_id: media_player.tts_kodi
# message: There are still windows open maybe you should close them first.
# - service: alarm_control_panel.alarm_disarm
#
# ## This will use the Xiaomi Gateway to sound an alarm if the system has been triggered
#
# - alias: Start Siren on Alarm Trigger
# trigger:
# - platform: state
# entity_id: alarm_control_panel.ha_alarm
# to: triggered
# action:
# - service: xiaomi_aqara.play_ringtone
# data:
# gw_mac: !secret xiaomimac
# ringtone_id: 0
# ringtone_vol: 80
# - service: light.turn_on
# entity_id: group.downstairs_lights
# - service: tts.google_say
# data:
# entity_id: media_player.tts_kodi
# message: Alarm triggered you have 2 minutes to reset or police will be contacted!
# - service: switch.turn_on
# data:
# entity_id: switch.away_alarm_triggered
#
# ## This will stop the siren once the correct alarm code has been entered
#
# - alias: Stop Alarm Siren
# trigger:
# - platform: state
# entity_id: alarm_control_panel.ha_alarm
# from: triggered
# action:
# - service: xiaomi_aqara.stop_ringtone
# data:
# gw_mac: !secret xiaomimac
# - service: tts.google_say
# data:
# entity_id: media_player.tts_kodi
# message: Alarm deactivated!
# - service: switch.turn_on
# data:
# entity_id: switch.alarm_deactivated
automation:
## Create daily snapshot of hassio
# - alias: Daily Backup at 3 AM
# trigger:
# platform: time
# at: '3:00:00'
# action:
# - service: hassio.snapshot_full
# data_template:
# name: Automated Backup {{ now().strftime('%Y-%m-%d') }}
## Upload snapshot to Dropbox
- alias: Upload dropbox 4AM
trigger:
platform: time
at: '4:00:00'
action:
- service: hassio.addon_stdin
data_template:
addon: 7be23ff5_dropbox_sync
input: {"command":"upload"}
- id: someones_ringing_the_bell
alias: Someone rang the doorbell
trigger:
- platform: state
entity_id: binary_sensor.ring_front_door_ding
to: 'on'
action:
- service: media_player.play_media
data_template:
entity_id: media_player.googlehome
media_content_id: https://ha.markdavies.com/local/audio/labrador.mp3
media_content_type: audio/mp3
- service: notify.pushbullet
data:
message: "{{ now().strftime('%a - %H:%M') }}: *Someone Rang The Doorbell*\nSomeone at the door rang the bell."
- service: notify.gmail
data:
title: Someone Rang the Doorbell
message: Someone at the door rang the bell!
automation:
- alias: 'Send Notification'
trigger:
...
action:
- service: notify.mobile_app_<your_device_id_here>
data:
message: "Notification text"
notify:
- name: ALL_DEVICES
platform: group
services:
- service: mobile_app_iphone_one
- service: mobile_app_iphone_two
- service: mobile_app_ipad_one
- service: mobile_app_pixel_4_xl
sequence:
- service: media_player.play_media
target:
entity_id: media_player.libreelec
data:
media_content_type: DIRECTORY
media_content_id: special://profile/playlists/video/krtek.m3u
mode: single
automation:
- alias: "Send Notification with a link"
trigger:
...
action:
- service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
# iOS URL
url: "/lovelace/cameras"
# Android URL
clickAction: "/lovelace/cameras"
automation:
- alias: "Notify of Motion click action"
trigger:
...
action:
- service: notify.mobile_app_<your_device_id_here>
data:
title: "Motion Detected in Backyard"
message: "Someone might be in the backyard."
data:
# iOS URL
url: "https://google.com"
# Android URL
clickAction: "https://google.com"
name: "Bedroom Late Night"
entities:
group.bedroom_shallow_accents:
state: on
brightness: 255
profile: cool_blue_shallow
transition: 15
group.bedroom_deep_accents:
state: on
brightness: 255
profile: cool_blue_deep
transition: 15
group.bedroom_base:
state: on
brightness: 255
rgb_color: [0, 35, 170]
transition: 15
alias: 'Auto Night Lights Bedroom'
trigger:
- platform: state
entity_id: binary_sensor.bedroom_motion
to: 'on'
condition:
- condition: state
entity_id: input_boolean.house_auto_lights
state: 'on'
- condition: state
entity_id: group.bedroom_lights
state: 'off'
- condition: sun
after: sunset
action:
- service: scene.turn_on
entity_id: scene.bedroom_night_light
- alias: Turn Light and Occupation On
initial_state: true
trigger:
- platform: state
entity_id: sensor.door
to: "on"
condition:
- condition: state
entity_id: switch.sonoff
state: "off"
- condition: state
entity_id: input_boolean.room_occupied
state: "off"
action:
- service: switch.turn_on
entity_id: switch.sonoff
- service: input_boolean.turn_on
entity_id: input_boolean.room_occupied
- alias: Turn Occupation Off
initial_state: true
trigger:
- platform: state
entity_id: sensor.door
to: "on"
condition:
- condition: state
entity_id: switch.sonoff
state: "on"
- condition: state
entity_id: input_boolean.room_occupied
state: "on"
action:
- service: input_boolean.turn_off
entity_id: input_boolean.room_occupied
- alias: Turn Light Off
initial_state: true
trigger:
- platform: state
entity_id: sensor.door
to: "off"
condition:
- condition: state
entity_id: switch.sonoff
state: "on"
- condition: state
entity_id: input_boolean.room_occupied
state: "off"
action:
- service: switch.turn_off
entity_id: switch.sonoff
alarm_control_panel:
- platform: manual
name: Alarm
code: !secret alarm_control_panel_code
# Don't require the code to arm the alarm
code_arm_required: false
# Arm again after triggering
disarm_after_trigger: false
# Delay from arming and becoming armed, eg. to leave the house.
arming_time: 120
# Allow time to disarm the alarm before it triggers, eg. when arriving home
delay_time: 60
# Amount of time the alarm is triggered for
trigger_time: 600
disarmed:
# Ensure the alarm can never be directly triggered when disarmed
trigger_time: 0
armed_home:
# Leave no delay between arming -> armed
arming_time: 0
# Leave no delay between pending -> triggered
delay_time: 0
- alias: "Alarm - Trigger when sensors go off"
trigger:
- platform: state
entity_id: binary_sensor.front_door
to: "on"
- platform: state
entity_id: binary_sensor.garage_entry
to: "on"
# Add more triggers here for other doors/windows
condition:
# Only trigger the alarm if it's armed
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_home
- condition: state
entity_id: alarm_control_panel.alarm
state: armed_away
action:
service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.alarm
- alias: "Alarm - Triggered"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: "triggered"
action:
- service: homeassistant.turn_on
entity_id: switch.siren
- alias: "Alarm - Disarmed"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: "disarmed"
action:
# Turn off the siren once the alarm is disarmed
- service: homeassistant.turn_off
entity_id: switch.siren
- alias: "Alarm - Pending"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
from: "armed_away" # No need for armed_home, there's no pending delay there.
to: "pending"
action:
- delay: 00:00:05 # Small delay for "Announce" automation to run.
- service: notify.alexa_media
data:
target:
- media_player.kitchen
data:
type: announce
message: "Please disarm the alarm"
# Start a timer to repeat the warning
- service: timer.start
entity_id: timer.alarm_pending
- alias: "Alarm - Pending Repeat"
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.alarm_pending
condition:
condition: state
entity_id: alarm_control_panel.alarm
state: pending
action:
- service: notify.alexa_media
data:
target:
- media_player.kitchen
data:
type: announce
message: "Disarm the alarm now!"
# Restart the timer
- service: timer.start
entity_id: timer.alarm_pending
- alias: "Alarm - Disarmed"
trigger:
- platform: state
entity_id: alarm_control_panel.alarm
to: "disarmed"
action:
# Turn off the siren once the alarm is disarmed
- service: homeassistant.turn_off
entity_id: switch.siren
# Stop the warning repeat timer
- service: timer.cancel
entity_id: timer.alarm_pending
The timer looks like this (directly in configuration.yaml).
timer:
# Used to repeat notifications that the alarm needs to be disarmed
alarm_pending:
duration: "00:00:10"
notify:
- name: ha_sendmail
platform: smtp
#if mail is on gmail
server: smtp.gmail.com
port: 587
timeout: 15
#from whom we send
sender: [email protected]
encryption: starttls
username: [email protected]
password: passwd
#to whom we send (you can use one box and send it to yourself, why not)
recipient:
sender_name: My Home Assistant
card_mod:
style: |
ha-card {
--ha-card-background: rgba(238,238,224);
--alarm-color-disarmed: var(--label-badge-green);
--alarm-color-armed: rgba(255,0,0) ! important;
--card-background-color: transparent;
--ha-card-header-color: black;
--alarm-color-triggered: rgba(255,0,0) ! important;
--ha-label-badge-label-text-transform: capitalized;
--mdc-button-outline-color: rgb(3,169,244);
--label-badge-background-color: yellow;
}
.iron-input > input{ color:#000 ! important;
}
# lovelace_gen
- title: Alarm
icon: 'mdi:shield'
path: alarm
cards:
- type: vertical-stack
cards:
- !include
- '../templates/system_header.yaml'
- name: "[[[ if (states['alarm_control_panel.alarm'].state == 'disarmed') return `The alarm is disarmed!`; else return `The alarm is armed!` ]]]"
icon: mdi:alert #fal:sensor-alert
content: Alarm
- type: custom:layout-card
cards:
- type: custom:layout-card
cards:
- type: alarm-panel
entity: alarm_control_panel.alarm
states:
- arm_home
- arm_away
{% raw %}
style:
.: |
ha-card {
overflow: hidden;
opacity: 0.7;
}
'#armActions mwc-button':
$: |
button {
min-height: 50px;
font-size: 18px !important;
--mdc-theme-primary: var(--primary-text-color); var(--name-color-off);
border-color: rgba(57,128,228,0) !important;
border-radius: 12px;
box-shadow: 0 0 8px 3px rgba(0, 0, 0, 0.2), 0 0 20px 6px rgba(0, 0, 0, 0.19);
}
'#keypad mwc-button:nth-of-type(11)':
$: |
:host {
background: transparent;
float: left !important;
}
button {
display: block;
min-height: 50px;
font-size: 28px !important;
--mdc-theme-primary: var(--primary-text-color); var(--name-color-off);
border-color: rgba(57,128,228,0) !important;
width: 50%;
border-radius: 12px;
box-shadow: 0 0 8px 3px rgba(0, 0, 0, 0.2), 0 0 20px 6px rgba(0, 0, 0, 0.19);
#box-shadow: 0 0 60px 30px #fff, 0 0 100px 60px #f0f, 0 0 140px 90px #0ff;
}
'#keypad mwc-button:nth-of-type(-n+9)':
$: |
:host {
background: transparent;
float: left !important;
}
button {
display: block;
min-height: 50px;
font-size: 28px !important;
--mdc-theme-primary: var(--primary-text-color); #var(--name-color-off);
border-color: rgba(57,128,228,0) !important;
width: 50%;
border-radius: 12px;
box-shadow: 0 0 8px 3px rgba(0, 0, 0, 0.2), 0 0 20px 6px rgba(0, 0, 0, 0.19);
}
'#keypad mwc-button:nth-of-type(12)':
$: |
button {
min-height: 50px;
font-size: 18px !important;
--mdc-theme-primary: var(--primary-text-color); var(--name-color-off);
border-color: rgba(57,128,228,0) !important;
border-radius: 12px;
box-shadow: 0 0 8px 3px rgba(0, 0, 0, 0.2), 0 0 20px 6px rgba(0, 0, 0, 0.19);
}
{% endraw %}
alias: 'Trigger alarm'
trigger:
- platform: state
entity_id: sensor.side_door_access, sensor.front_door_access, sensor.back_door_access
to: 'open'
condition:
condition: or
conditions:
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_away
- condition: state
entity_id: alarm_control_panel.ha_alarm
state: armed_home
action:
- service: alarm_control_panel.alarm_trigger
entity_id: alarm_control_panel.ha_alarm
- service: notify.pushover
data_template:
message: '{{ trigger.to_state.attributes.friendly_name }} opened'
data:
title: 'Alarm'
card_mod:
style: |
ha-card {
--ha-card-background: rgba(238,238,224);
--alarm-color-disarmed: rgb(13,160,53);
--alarm-color-armed: rgba(255,0,0) ! important;
--card-background-color: transparent;
--ha-card-header-color: black;
--alarm-color-triggered: rgba(255,0,0) ! important;
--ha-label-badge-label-text-transform: capitalized;
--mdc-button-outline-color: rgb(3,169,244);
--primary-text-color: #000;
--ha-label-badge: inherit ;
position: absolute;
right: 80px ! important;
top: 20px ! important;
}
- alias: L-ST Study Lights Off If No Person Present For 5 Min
id: "1603640030052"
description: ""
trigger:
- entity_id: binary_sensor.study_motion_sensor_motion
platform: state
from: "on"
to: "off"
for: 00:15:00
- minutes: /5
platform: time_pattern
condition:
- entity_id: binary_sensor.study_motion_sensor_motion
condition: state
state: "off"
for: 00:15:00
action:
- service: light.turn_off
entity_id: light.study_ceiling_light
- service: light.turn_off
entity_id: light.study_lamps
- service: switch.turn_off
entity_id: switch.study_screen_led
- alias: Turn TV lights to orange when watching Hockey
trigger:
platform: state
entity_id: media_player.living_room_chromecast
to: 'playing'
condition:
condition: or
conditions:
- condition: template
value_template: "{{ 'Flyers' in state_attr('media_player.living_room_chromecast', 'media_title') }}"
- condition: template
value_template: "{{ is_state_attr('media_player.living_room_chromecast', 'app_name', 'Chrome Mirroring') }}"
action:
- service: light.turn_on
data:
entity_id: light.living_room
rgb_color: [255,137,32]
- service: light.turn_on
data:
entity_id: light.living_room
rgb_color: [255,137,32]
alias: Alarm - Flash en Sirene 01 - Aan
sequence:
- data:
duration: 60
duty_cycle: 2
ieee: '00:0d:6f:00:13:1a:xx:xx'
intensity: 2
level: 1
mode: 1
strobe: 1
service: zha.warning_device_warn
mode: single
icon: 'mdi:volume-high'
Blockquote
ieee: use adress of the sirene
Options:
strobe: 1 (Strobe ON)
strobe: 0 (Strobe OFF)
mode: 1 (Sirene ON)
mode: 0 (Sirene OFF)
duration: time of the sirene / Strobe in seconds
alarm_control_panel: # This is the STANDARD control panel, without any kind of check before arming.
- platform: manual
name: Standard Alarm
code: !secret alarm_code
code_arm_required: false # Don't need code to arm the alarm
# When alarm is triggered, sets the n. of seconds of alarm siren.
trigger_time: 120
disarmed:
trigger_time: 0
armed_home:
delay_time: 0 # delay when arming (to exit the house)
arming_time: 0 # delay when triggering (to disable the alarm after you come back)
armed_away:
delay_time: 20
arming_time: 0
armed_night:
delay_time: 20
arming_time: 0
- platform: template
panels:
safe_alarm: # This is the SMART alarm that checks that doors are closed before arming. In lovelace I use this alarm panel.
name: Antifurto
value_template: "{{ states('alarm_control_panel.standard_alarm') }}"
arm_home: #Day Alarm
- choose:
- conditions: # If doors are closed
- condition: state
entity_id: binary_sensor.door1, binary_sensor.door2, binary_sensor.door3
state: 'off'
sequence:
- service: alarm_control_panel.alarm_arm_home # arm
data:
entity_id: alarm_control_panel.standard_alarm
code: !secret alarm_code
default:
- service: notify.alexa_media # Else, Alexa says that some accesses are left open.
data:
target: media_player.alexa
data:
type: announce
method: spoken
message: "Some doors are not closed. Alarm system not enabled."
arm_night: #Night Alarm
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.door1, binary_sensor.door2, binary_sensor.door3, binary_sensor.window1, binary_sensor.window2
state: 'off'
sequence: # Arm alarm if doors and windows selected are closed.
- service: alarm_control_panel.alarm_arm_night
data:
entity_id: alarm_control_panel.standard_alarm
code: !secret alarm_code
default: # Else Alexa says that something is open and so alarm is not active
- service: notify.alexa_media
data:
target: media_player.alexa
data:
type: announce
method: spoken
message: "Some doors are not closed. Alarm system not enabled."
arm_away: # Total Alarm
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.door1, binary_sensor.door2, binary_sensor.door3, binary_sensor.window1, binary_sensor.window2
state: 'off'
sequence: # Alarm if everything is closed
- service: alarm_control_panel.alarm_arm_away
data:
entity_id: alarm_control_panel.standard_alarm
code: !secret alarm_code
default: # Else Alexa says
- service: notify.alexa_media
data:
target: media_player.alexa
data:
type: announce
method: spoken
message: "Some doors are not closed. Alarm system not enabled."
disarm:
- condition: template
value_template: "{{ code == '123123' }}" # Unfortunately it was - at the time I wrote the code - not possible to use secrets inside templates
- service: alarm_control_panel.alarm_disarm
data:
entity_id: alarm_control_panel.standard_alarm
code: !secret alarm_code
konnected: !include konnected.yaml # where I have declared sensors
automation:
- id: alarm_arm_home_at_night
alias: 'Alarm: Arm Home at night'
description: 'Arms the alarm, and locks the doors'
initial_state: 'on'
condition:
- condition: state
entity_id: group.household
state: 'home'
trigger:
platform: time
at: '22:00:00'
action:
- service: alarm_control_panel.alarm_arm_night
entity_id: alarm_control_panel.home_alarm
- service: lock.lock
entity_id: group.all_house_locks
- id: alarm_arm_home_when_away
alias: 'Alarm: Arm home when everyone is out'
trigger:
- entity_id: group.household
platform: state
from: 'home'
to: 'away'
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.home_alarm
- service: notify.admins
data:
message: Alarm has been set to away.
title: 'Home Alarm'
- id: 'alarm_arm_home_when_away'
alias: 'Alarm: Arm home when everyone is out'
trigger:
- entity_id: group.family
platform: state
from: 'home'
to: 'away'
action:
- service: alarm_control_panel.alarm_arm_away
entity_id: alarm_control_panel.home_alarm
- service: notify.mobile_app_sm_888888
data_template:
message: 'Alarm set to away | {{now().strftime("%H:%M:%S")}}'
title: ALERT !
data:
ttl: 0
priority: high
mode: single
animate: true
color_thresholds:
- color: '#a55eea'
value: -6.9
- color: '#8854d0'
value: -3.9
- color: '#3867d6'
value: -1.2
- color: '#4b7bec'
value: 1.6
- color: '#2d98da'
value: 4.3
- color: '#45aaf2'
value: 7.1
- color: '#0fb9b1'
value: 9.9
- color: '#2bcbba'
value: 12.7
- color: '#20bf6b'
value: 15.5
- color: '#26de81'
value: 18.2
- color: '#fed330'
value: 21
- color: '#f7b731'
value: 23.8
- color: '#fd9644'
value: 26.6
- color: '#fa8231'
value: 29.3
- color: '#fc5c65'
value: 32.1
- color: '#eb3b5a'
value: 35.9
entities:
- entity: sensor.openweathermap_temperature
index: 0
name: Carport
show_state: true
state_adaptive_color: true
- color: '#666666'
entity: sensor.solar_elevation
line_width: 1
show_fill: false
show_legend: false
show_state: false
y_axis: secondary
hour24: true
hours_to_show: 24
line_width: 2
lower_bound_secondary: ~0
name: Temperatur
points_per_hour: 12
show:
extrema: true
graph: line
points: false
type: 'custom:mini-graph-card'
- id: '1588702585432'
alias: Bathroom Light On-Off
description: Controls bathroom light based on motion sensor
trigger:
- device_id: 235db833caa54d49bddcb05b0f04ba12
domain: binary_sensor
entity_id: binary_sensor.neo4
platform: device
type: motion
condition: []
action:
- brightness_pct: 90
device_id: db52735c5e564774a9d7d19dd6d44e82
domain: light
entity_id: light.bathroom_light
type: turn_on
- delay: 00:03:30
- timeout: 00:00:00
wait_template: '{{ is_state(''binary_sensor.neo4'', ''off'') }}'
- brightness_pct: 50
device_id: db52735c5e564774a9d7d19dd6d44e82
domain: light
entity_id: light.bathroom_light
type: turn_on
- delay: 00:00:15
- device_id: db52735c5e564774a9d7d19dd6d44e82
domain: light
entity_id: light.bathroom_light
type: turn_off
mode: restart
input_boolean:
infrared_device:
name: My infrared device
switch:
- platform: template
switches:
infrared_device:
value_template: '{{ is_state("input_boolean.infrared_device", "on") }}'
turn_on:
- condition: state
entity_id: input_boolean.infrared_device
state: 'off'
- service: input_boolean.toggle
data:
entity_id: input_boolean.infrared_device
- service: send infrared command
turn_off:
- condition: state
entity_id: input_boolean.infrared_device
state: 'on'
- service: input_boolean.toggle
data:
entity_id: input_boolean.infrared_device
- service: send infrared command
- card: 'media-control'
wider: true
widerSize: 2
noPadding: true
cardOptions:
entity: media_player.tv_living
name: Q90R
style: |
ha-card {
padding: 2px !important;
display: flex !important;
flex-direction: column !important;
background: transparent !important;
box-shadow: none !important;
border-radius:0 !important;
}
.player {
position: relative;
padding: 5px;
height: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
justify-content: space-between;
color: var(--text-primary-color);
transition-property: color, padding;
transition-duration: 0.4s;
}
automation:
- alias 'link main light to lamp on'
trigger:
platform: state
entity_id: light.lohasone
to: 'on'
action:
service: light.turn_on
entity_id: light.treelamp
- alias 'link main light to lamp off'
trigger:
platform: state
entity_id: light.lohasone
to: 'unavailable'
action:
service: light.turn_off
entity_id: light.treelamp
- alias: Scheduled Light
trigger:
- platform: time
at:
- '21:00:00'
- '05:00:00'
- platform: homeassistant