-
Notifications
You must be signed in to change notification settings - Fork 1
/
automations.yaml
1782 lines (1782 loc) · 67.5 KB
/
automations.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
- id: '1584476995764'
alias: Notification - SWMBO Arrives
description: ''
triggers:
- entity_id: person.kirstyn_rolfe
to: home
trigger: state
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.dyson_parkes
state: home
alias: Confirm Dyson is out
actions:
- data:
message: Kirstyn just arrived
title: Kirstyn's Home
alias: Mobile notification
action: notify.mobile_app_bnet_reno12
mode: single
- id: '1597613199016'
alias: 'Lovelace: convert lovelace.json to lovelace-ui.yaml'
description: Convert lovelace.json to lovelace-ui.yaml
trigger:
- platform: event
event_type: lovelace_updated
event_data: {}
context:
user_id:
- 08d29e434e9a4bed98b3a62218eac7a7
action:
- service: shell_command.convert_lovelace
mode: single
- id: '1602904795038'
alias: Notification - HAss Update Available
description: ''
triggers:
- entity_id:
- update.home_assistant_core_update
to: 'on'
for:
hours: 0
minutes: 0
seconds: 0
trigger: state
conditions:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
actions:
- parallel:
- data:
message: Home Assistant {{ state_attr('update.home_assistant_core_update',
'latest_version') }} is available.
title: Update Available!
target:
- '819351502640381952'
alias: Discord notification
action: notify.homeassistant
- data:
message: Home Assistant {{ state_attr('update.home_assistant_core_update',
'latest_version') }} is available.
alias: Facebook notification
action: notify.facebook_text
- device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
alias: Notify Oppo Reno12 - Mobile
enabled: true
variables:
notification_title: Home Assistant Update Available!
notification_message: ' Home Assistant {{ state_attr(''update.home_assistant_core_update'',
''latest_version'') }} is available.'
mode: single
- id: '1603311446063'
alias: Github - Convert Lovelace json to yaml and commit
description: ''
trigger:
- platform: event
event_type: lovelace_updated
event_data: {}
condition: []
action:
- service: shell_command.convert_lovelace
- delay: '5'
- service: shell_command.commit_lovelace
data: {}
initial_state: false
mode: single
- id: '1605335470308'
alias: Notification - SWMBO home and away
description: Is she home or isn't she?
trigger:
- platform: state
entity_id: person.kirstyn_rolfe
from: home
to: not_home
- platform: state
entity_id: person.kirstyn_rolfe
from: not_home
to: home
condition: []
action:
- service: persistent_notification.create
data:
notification_id: Kirstyn
title: Kirstyn is {{ trigger.to_state.state }}
message: Kirstyn went from {{ trigger.from_state.state }} to {{ trigger.to_state.state
}} at {{ now().strftime('%H:%M %d/%m/%Y') }}
mode: single
- id: '1608262512161'
alias: Notification - Happy Birthday Sir
description: A silly little automation to have HAss wish me happy birthday
trigger:
- platform: state
entity_id:
- sensor.birthday_me
to: '0'
for:
hours: 7
minutes: 0
seconds: 0
condition:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
action:
- service: notify.notify
data:
message: Happy Birthday Sir!
title: Bappy Hirthday
mode: single
- id: '1608262874242'
alias: Notification - Birthday Reminders
description: Remind me of upcoming birthdays
trigger:
- platform: state
entity_id:
- sensor.birthday_swmbo
- sensor.birthday_me
to: '1'
condition: []
action:
- service: persistent_notification.create
data:
notification_id: Birthday
title: Upcoming birthday!
message: '''{{trigger.to_state.attributes.friendly_name}} is tomorrow!'''
mode: single
- id: '1608606143148'
alias: System - Install additional packages
description: Installs packages defined in a shell script
trigger:
- platform: homeassistant
event: start
condition: []
action:
- delay: 00:00:10
- service: shell_command.install_extra_packages
data: {}
mode: single
initial_state: false
- id: '1618826864131'
alias: Notification - Welcome Home Sir
description: ''
trigger:
- platform: state
entity_id:
- person.dyson_parkes
to: home
for:
hours: 0
minutes: 2
seconds: 0
condition:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
- condition: time
before: '23:00:00'
after: 08:00:00
alias: Not nighttime
- condition: not
conditions:
- condition: state
entity_id: person.kirstyn_rolfe
state: home
alias: Kirstyn location check
alias: Kirstyn isn't home
action:
- service: notify.alexa_media_lounge_dot
data:
data:
type: tts
target: media_player.lounge_dot
message: Welcome home m'lord
alias: Welcome home via lounge dot
enabled: false
- service: notify.alexa_media_doppler
data:
data:
type: tts
target: media_player.doppler
message: Welcome home m'lord
alias: Welcome home via doppler
enabled: true
mode: single
- id: '1621926272836'
alias: Lights - Turn on to greet me
description: ''
trigger:
- platform: zone
entity_id: person.dyson_parkes
zone: zone.home
event: enter
condition:
- condition: and
conditions:
- condition: sun
before: sunrise
after: sunset
alias: Confirm the sun's not up
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
action:
- service: light.turn_on
data:
transition: 2
target:
entity_id: light.lifx_switch_6c31d6_porch
- service: light.turn_on
data:
transition: 2
brightness_pct: 100
target:
entity_id: light.bedroom
enabled: false
mode: single
- id: '1623151855818'
alias: Amp Power - Sync sub with amp
description: ''
trigger:
- platform: state
entity_id:
- media_player.lounge_amp_3
for:
hours: 0
minutes: 0
seconds: 1
- platform: homeassistant
event: start
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: media_player.lounge_amp_3
state: 'off'
sequence:
- target:
entity_id: switch.subwoofer
data: {}
action: switch.turn_off
- conditions:
- condition: state
state: standby
entity_id: media_player.lounge_amp_3
sequence:
- target:
entity_id: switch.subwoofer
data: {}
action: switch.turn_off
- conditions:
- condition: state
entity_id: media_player.lounge_amp_3
state: idle
enabled: true
sequence:
- target:
entity_id: switch.subwoofer
data: {}
action: switch.turn_off
- conditions:
- condition: state
entity_id: media_player.lounge_amp_3
state: unavailable
enabled: true
sequence:
- target:
entity_id: switch.subwoofer
data: {}
action: switch.turn_off
default:
- data: {}
target:
entity_id: switch.subwoofer
action: switch.turn_on
mode: single
- id: '1639688722323'
alias: Amp Power - Sync sub with amp (on startup)
description: ''
trigger:
- platform: homeassistant
event: start
condition: []
action:
- choose:
- conditions:
- condition: not
conditions:
- condition: state
entity_id: media_player.lounge_amp_3
state: 'off'
alias: Confirm lounge amp is not off
sequence:
- service: switch.turn_on
target:
entity_id: switch.subwoofer
data: {}
- conditions:
- condition: state
entity_id: media_player.lounge_amp_3
state: 'off'
sequence:
- service: switch.turn_off
target:
entity_id: switch.subwoofer
data: {}
default: []
mode: single
- id: '1651206195438'
alias: Notification - HAssOS Update Available
description: ''
triggers:
- entity_id:
- update.home_assistant_operating_system_update
to: 'on'
for:
hours: 0
minutes: 0
seconds: 1
trigger: state
conditions:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
actions:
- parallel:
- data:
message: Home Assistant OS {{ state_attr('update.home_assistant_operating_system_update',
'latest_version') }} is available.
title: Update Available
alias: Browser notification
action: notify.html5_notifications
- data:
message: Home Assistant OS {{ state_attr('update.home_assistant_operating_system_update',
'latest_version') }} is available.
title: Update Available!
target:
- '819351502640381952'
alias: Discord notification
action: notify.homeassistant
- data:
message: Home Assistant OS {{ state_attr('update.home_assistant_operating_system_update',
'latest_version') }} is available.
alias: Facebook notification
action: notify.facebook_text
mode: single
- id: '1655351847580'
alias: Amp Volume - Change Input
description: Changes volume on the Lounge amplifier to suit whatever levels are
received from the differing sources
trigger:
- platform: state
entity_id:
- media_player.lounge_amp_2
for:
hours: 0
minutes: 0
seconds: 0
attribute: media_title
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: media_player.lounge_amp_2
attribute: media_title
state: BD/DVD
for:
hours: 0
minutes: 0
seconds: 0
alias: PC (BD/DVD)
sequence:
- target:
entity_id: media_player.lounge_amp_2
data:
volume_level: 0.73
action: media_player.volume_set
- conditions:
- condition: state
entity_id: media_player.lounge_amp_2
attribute: media_title
state: GAME
for:
hours: 0
minutes: 0
seconds: 0
alias: PS5 (GAME)
sequence:
- target:
entity_id: media_player.lounge_amp_2
data:
volume_level: 0.27
action: media_player.volume_set
- conditions:
- condition: state
entity_id: media_player.lounge_amp_2
attribute: media_title
state: SA-CD/CD
for:
hours: 0
minutes: 0
seconds: 0
alias: Xbox SX (SA-CD/CD)
sequence:
- target:
entity_id: media_player.lounge_amp_2
data:
volume_level: 0.335
action: media_player.volume_set
- conditions:
- condition: state
entity_id: media_player.lounge_amp_2
attribute: media_title
state: VIDEO 2
for:
hours: 0
minutes: 0
seconds: 0
alias: Xbox One (VIDEO 2)
sequence:
- target:
entity_id: media_player.lounge_amp_2
data:
volume_level: 0.335
action: media_player.volume_set
- conditions:
- condition: state
entity_id: media_player.lounge_amp_2
attribute: media_title
state: TV
for:
hours: 0
minutes: 0
seconds: 0
alias: TV
sequence:
- target:
entity_id: media_player.lounge_amp_2
data:
volume_level: 0.55
action: media_player.volume_set
default: []
mode: single
- id: '1665709420254'
alias: Doppler - Button 1
description: Toggles a light on push of Doppler smart button 1
trigger:
- platform: device
domain: sandman_doppler
device_id: 71b40ef41901e6650f2ec43ddd2b63dc
button: 1
type: sandman_doppler_button_pressed
subtype: 1
condition: []
action:
- service: light.toggle
data: {}
target:
entity_id: light.bedroom_light
mode: single
- id: '1665709479272'
alias: Doppler - Button 2
description: Toggles a light on push of Doppler smart button 2
trigger:
- platform: device
domain: sandman_doppler
device_id: 71b40ef41901e6650f2ec43ddd2b63dc
button: 2
type: sandman_doppler_button_pressed
subtype: 2
condition: []
action:
- service: light.toggle
data: {}
target:
entity_id: light.bedroom_lamp
mode: single
- id: '1666768764502'
alias: Printer - Notify if out of paper
description: Talks through the speakers to notify if the printer runs out of paper
trigger:
- platform: state
entity_id:
- sensor.mfc_9340cdw_status
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
- condition: time
before: '23:00:00'
after: 08:00:00
alias: Not nighttime
action:
- service: notify.alexa_media_dyson_s_echo_dot
data:
data:
type: tts
target: media_player.dyson_s_echo_dot
message: The printer has run out of paper
alias: Printer status via lounge dot
enabled: true
mode: single
- id: '1679630068333'
alias: 1-NSPanel Configuration
description: ''
use_blueprint:
path: Blackymas/nspanel_blueprint.yaml
input:
language: ENG
nspanel_name: devpanel
delay: 4
weather: AccuWeather
weather_entity: weather.home
left_button_entity: light.office_light
left_button_name: Light
right_button_entity: light.office_lamp
right_button_name: Lamp
- id: '1688357078253'
alias: Garage Lights (Switch toggle all)
description: Allows the bottom switch on the garage panel to toggle all lights in
the area.
trigger:
- platform: device
device_id: 06ba335d596e242b91bb5ffd677c8d0e
domain: homekit_controller
type: button4
subtype: single_press
condition: []
actions:
- action: light.toggle
data: {}
target:
area_id: garage
mode: single
- id: '1694906150147'
alias: Automation - empty the house
description: Turn off all lights when the last person leaves the house
trigger:
- platform: state
entity_id:
- zone.home
to: '0'
for:
hours: 0
minutes: 30
seconds: 0
condition:
- alias: Confirm phone is not on home wifi
condition: not
conditions:
- condition: state
entity_id: sensor.bnet_reno12_wifi_connection
state: Berserkir-Net
enabled: false
action:
- data: {}
target:
entity_id:
- light.all_lights
- light.all_lamps
alias: Turn off "All Lights" and "All Lamps"
action: light.turn_off
- if:
- condition: template
value_template: ' {% if not is_state(''select.front_door_recording_mode'',
''Detections'') %}true{% endif %}'
alias: Confirm if the Front Camera is not set to Motion
then:
- metadata: {}
data:
option: Detections
target:
entity_id: select.front_door_recording_mode
alias: Set Front Door Camera back to record on motion
action: select.select_option
alias: Set the Front Door camera to Motion if it's not
mode: single
- id: '1713308537578'
alias: Motion - Front Door Camera
description: Send a notification if motion is detected by cameras and nobody is
home
trigger:
- platform: state
entity_id: binary_sensor.front_door_motion
from: 'off'
to: 'on'
alias: Motion at Front Door
condition: []
action:
- entity_id: camera.front_door_high
data:
filename: '{{ snapshot_create_file_path }}'
action: camera.snapshot
alias: Create motion snapshot
- alias: Turn on porch light if motion activation is on and it's dark
if:
- condition: state
entity_id: input_boolean.front_door_motion_light
state: 'on'
- type: is_on
condition: device
device_id: 4b8020c3a743f4a57e058fb2d8e87739
entity_id: 0bcb583a926e88bf9ae0c5af59a7a149
domain: binary_sensor
alias: Front Door camera is dark
then:
- action: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.lifx_switch_6c31d6_porch
alias: Turn on porch light
- device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
data: '{% set android_data = {"image": "%s"} | format(snapshot_access_file_path)
%} {% set ios_data = {"attachment": {"url": "%s", "content_type": "JPEG"}} |
format(snapshot_access_file_path) %} {{ ios_data if is_ios else android_data
}}'
alias: Notify Oppo Reno12 - Mobile
enabled: false
- choose:
- conditions:
- condition: state
entity_id: zone.home
state: '0'
alias: Confirm nobody is home
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
sequence:
- device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
data: '{% set android_data = {"image": "%s"} | format(snapshot_access_file_path)
%} {% set ios_data = {"attachment": {"url": "%s", "content_type": "JPEG"}}
| format(snapshot_access_file_path) %} {{ ios_data if is_ios else android_data
}}'
alias: Notify Oppo Reno12 - Mobile
alias: Notify if nobody is home and dnd is off
- conditions:
- condition: not
conditions:
- condition: state
entity_id: zone.home
state: '0'
alias: Confirm nobody is home
alias: Confirm home has someone in it
- condition: state
entity_id: input_boolean.motion_notifications
state: 'on'
- condition: state
entity_id: input_boolean.silent_mode
state: 'off'
sequence:
- device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ notification_title }}'
message: '{{ notification_message }}'
data: '{% set android_data = {"image": "%s"} | format(snapshot_access_file_path)
%} {% set ios_data = {"attachment": {"url": "%s", "content_type": "JPEG"}}
| format(snapshot_access_file_path) %} {{ ios_data if is_ios else android_data
}}'
alias: Notify Oppo Reno12 - Mobile
alias: Notify if notifications are on and house isn't silent
variables:
motion_sensor: binary_sensor.front_door_motion
motion_sensor_name: '{{ states[motion_sensor].name }}'
camera: camera.front_door_high
notify_device: e9f5ed78657f507d268be05f2ba5119d
is_ios: false
notification_title: Motion detected!
notification_message: '{{ motion_sensor_name }} detected movement!'
delay: 6
snapshot_create_file_path: /config/www/tmp/snapshot_{{ states[camera].object_id
}}.jpg
snapshot_access_file_path: '{{ snapshot_create_file_path | replace(''/config/www'',''/local'')
}}'
mode: single
- id: '1714359343699'
alias: Notification - Rack UPS has lost power
description: ''
triggers:
- alias: Input Voltage drops
type: voltage
device_id: 58a59dd95bfaeda8f7edc53ca2980388
entity_id: 85b741fd9ea2e80d5f9f59b95620ad86
domain: sensor
below: 120
trigger: device
conditions:
- alias: Confirm NOT
condition: not
conditions:
- condition: zone
entity_id: person.dyson_parkes
zone: zone.home
alias: Check Dyson isn't home
actions:
- parallel:
- data:
message: The rack UPS has lost power
title: Power Failure
alias: Browser notification
action: notify.html5
- data:
message: The rack UPS has lost power
title: Power Failure
alias: Mobile notification
action: notify.mobile_app_bnet_reno12
alias: Run notifications in parallel
mode: single
- id: '1720685093544'
alias: Front door light motion trigger
description: ''
trigger:
- type: motion
platform: device
device_id: 4b8020c3a743f4a57e058fb2d8e87739
entity_id: 1ac1eaf9e3b055f0ae32cb5f4348b008
domain: binary_sensor
alias: Motion detected on front door camera
condition:
- condition: state
entity_id: input_boolean.front_door_motion_light
state: 'on'
alias: Check motion triggering is active
action:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.lifx_switch_6c31d6_porch
alias: Turn on porch light
mode: single
- id: '1720685277657'
alias: Light - activate porch motion trigger
description: ''
trigger:
- platform: device
device_id: 11a829db81b9e8ab2c8def0bfcdbca8d
domain: homekit_controller
type: button2
subtype: long_press
alias: Hall button 2 long-pressed
- platform: device
device_id: 11a829db81b9e8ab2c8def0bfcdbca8d
domain: homekit_controller
type: button2
subtype: double_press
alias: Hall button 2 double-pressed
condition: []
action:
- service: input_boolean.toggle
metadata: {}
data: {}
target:
entity_id: input_boolean.front_door_motion_light
alias: Toggle front door motion triggering
mode: single
- id: '1726543997412'
alias: Notification - System Updates
description: ''
trigger:
- id: new
platform: state
entity_id:
- update.home_assistant_core_update
- update.home_assistant_operating_system_update
- update.home_assistant_supervisor_update
to: 'on'
- id: started
platform: state
entity_id:
- update.home_assistant_core_update
- update.home_assistant_operating_system_update
- update.home_assistant_supervisor_update
attribute: in_progress
from: false
to: true
- id: done
platform: state
entity_id:
- update.home_assistant_core_update
- update.home_assistant_operating_system_update
- update.home_assistant_supervisor_update
from: 'on'
to: 'off'
- id: install
platform: event
event_type: mobile_app_notification_action
event_data:
action: install-update
- id: install_ios
platform: event
event_type: mobile_app_notification_action
event_data:
actionName: install-update
- id: skip
platform: event
event_type: mobile_app_notification_action
event_data:
action: skip-update
- id: skip_ios
platform: event
event_type: mobile_app_notification_action
event_data:
actionName: skip-update
- id: core_check
platform: template
value_template: "{% set ns = namespace(core=none) %} {% for u in integration_entities('hassio')
| select('in', update_entities)\n if (device_attr(u, 'identifiers') |
first)[1] == 'core' %}\n {% set ns.core = u %}\n{% endfor %} {% if run_config_check
and ns.core is string and expand(ns.core) | first | attr('state') == 'on' %}\n
\ {% for e in expand(integration_entities('hassio')) | selectattr('attributes.device_class',
'eq', 'running')\n if (device_attr(e.entity_id, 'identifiers') | first)[1]
== 'core_check_config' %}\n {{ e.state == 'off' and e.last_changed > expand(ns.core)
| first | attr('last_changed') }}\n {% endfor %}\n{% else %}\n {{ false }}\n{%
endif %}"
- id: ha_start
platform: homeassistant
event: start
- platform: template
value_template: "{{ states.update | selectattr('state', 'eq', 'on') | list | count
> 0\n and reminder_hours > 0 and now().hour % reminder_hours == 0\n and now().minute
== 0 and now().second == 0 }}"
- id: sticky_ios
platform: event
event_type: mobile_app_notification_action
event_data:
action: URI
action:
- choose:
- alias: Install update action
conditions:
- condition: template
value_template: '{{ trigger.id in [''install'', ''install_ios''] }}'
sequence:
- variables:
entity_id: "update.{{ trigger.event.data.tag\n if trigger.event.data.tag
is string and trigger.event.data.tag != ''\n else trigger.event.data.action_data.tag
}}"
- data:
entity_id: '{{ entity_id }}'
backup: '{% set ids = device_attr(entity_id, ''identifiers'') | first %}
{{ take_backup and ids[0] == ''hassio'' and ids[1] not in [''supervisor'',
''OS''] }}'
action: update.install
- alias: Skip update action
conditions:
- condition: template
value_template: '{{ trigger.id in [''skip'', ''skip_ios''] }}'
sequence:
data:
entity_id: "update.{{ trigger.event.data.tag\n if trigger.event.data.tag
is string and trigger.event.data.tag != ''\n else trigger.event.data.action_data.tag
}}"
action: update.skip
- alias: Update completed
conditions:
- condition: template
value_template: '{{ trigger.id == ''done'' }}'
sequence:
- variables:
entity_id: '{{ trigger.entity_id }}'
- variables:
message: clear_notification
data:
tag: '{{ entity_id[7:] }}'
- choose: []
default:
- variables:
data: '{{ dict(data, action_data={''tag'': data.tag}) }}'
- choose:
alias: Send to first mobile device if specified
conditions:
- condition: template
value_template: '{{ not not mobile_app_device }}'
sequence:
device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ title | default('''') }}'
message: "{{ message if device_attr(mobile_app_device, 'manufacturer')
!= 'Apple'\n else message | replace('<br>', '\\n') }}"
data: "{{ data if\n device_attr(mobile_app_device, 'manufacturer')
!= 'Apple' or data.icon_url is not string\n else dict(data, image=data.icon_url)
}}"
- choose:
- alias: Send to second mobile device if specified
conditions:
- condition: template
value_template: '{{ not not mobile_app_device_2 }}'
sequence:
device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ title | default('''') }}'
message: "{{ message if device_attr(mobile_app_device_2, 'manufacturer')
!= 'Apple'\n else message | replace('<br>', '\\n') }}"
data: "{{ data if\n device_attr(mobile_app_device_2, 'manufacturer')
!= 'Apple' or data.icon_url is not string\n else dict(data, image=data.icon_url)
}}"
- alias: Dismiss from HA if replicating there
choose:
- conditions:
- condition: template
value_template: '{{ send_to_ha }}'
sequence:
data:
notification_id: '{{ entity_id[7:] }}'
action: persistent_notification.dismiss
- alias: On startup, dismiss core and os notifications as they occurred while
off
conditions:
- condition: template
value_template: '{{ trigger.id == ''ha_start'' }}'
sequence:
- alias: Dismiss core update notification if off
choose:
conditions:
- condition: template
value_template: '{{ core_update_entity != '''' and expand(core_update_entity)
| first | attr(''state'') == ''off'' }}'
sequence:
- variables:
entity_id: '{{ core_update_entity }}'
- variables:
message: clear_notification
data:
tag: '{{ entity_id[7:] }}'
- choose: []
default:
- variables:
data: '{{ dict(data, action_data={''tag'': data.tag}) }}'
- choose:
alias: Send to first mobile device if specified
conditions:
- condition: template
value_template: '{{ not not mobile_app_device }}'
sequence:
device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ title | default('''') }}'
message: "{{ message if device_attr(mobile_app_device, 'manufacturer')
!= 'Apple'\n else message | replace('<br>', '\\n') }}"
data: "{{ data if\n device_attr(mobile_app_device, 'manufacturer')
!= 'Apple' or data.icon_url is not string\n else dict(data,
image=data.icon_url) }}"
- choose:
- alias: Send to second mobile device if specified
conditions:
- condition: template
value_template: '{{ not not mobile_app_device_2 }}'
sequence:
device_id: 11ecfffb8a3d3e8cb0640a1f7d3ec024
domain: mobile_app
type: notify
title: '{{ title | default('''') }}'
message: "{{ message if device_attr(mobile_app_device_2, 'manufacturer')
!= 'Apple'\n else message | replace('<br>', '\\n') }}"
data: "{{ data if\n device_attr(mobile_app_device_2, 'manufacturer')
!= 'Apple' or data.icon_url is not string\n else dict(data,