-
Notifications
You must be signed in to change notification settings - Fork 7
/
notifications.yaml
1285 lines (1112 loc) · 52.8 KB
/
notifications.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
mode: restart
blueprint:
name: 🔔 Notifications (Version 2.0.2 Beta)
source_url: https://github.com/samuelthng/t-house-blueprints/blob/main/notifications.yaml
homeassistant:
min_version: 2023.11.0
domain: script
author: samuelthng/t-house-blueprints
description: >-
<div>
<h2>🔔 Notifications</h2>
<b>Version 2.0.2 Beta</b> | 🔗 <a href="https://github.com/samuelthng/t-house-blueprints/blob/main/notifications.yaml" target="_blank">Github Link</a> | 💬 <a href="https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552" target="_blank">Community Post</a>
</div>
<br>
---
### Features:
> 📲 Sends notification to [Home Assistant Companion](https://companion.home-assistant.io/)
> 3️⃣ Up to 3 customisable, action buttons (Previously: ✅ Confirm and ❌ Dismiss Button)
> ⌛️ Timeout actions with custom duration, fired if no option response received
> 🧹 Clear notification after timeout
> 📸 Camera Snapshots
> 🔗 Custom Notification Link
> 📜 Flexible [script fields](https://www.home-assistant.io/integrations/script/#fields)
> 🍎 Supports iOS
> 🤖 Supports Android
Examples can be found [here](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#example-usage-6)
### Changelog
<details>
<summary>Expand/collapse changelog</summary>
### Version 2.0.2 Beta Multiple Device - *19 Jan 2023*
- Added: Field for `notification_link`. [#26](https://github.com/samuelthng/t-house-blueprints/pull/26) (Thanks to [HNKNTA](https://github.com/HNKNTA))
- Fixed: Field `enable_timeout`.
- Added: `response_variable` with payload and response.
### Version 2.0.1 - *20 Dec 2023* [🔗](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552/111?u=samuelthng)
### Version 2 - *12 Dec 2023* [🔗](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552/109)
### Version 1.6.1 - *26 Oct 2023* [🔗](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552/66)
### Version 1.6 - *26 Oct 2023* [🔗](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552/62)
### Version 1.5 - *11 Oct 2023* [🔗](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/551552#version-14-7-jul-2023-8)
### Version 1.4 - *7 Jul 2023* [🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-14-7-jul-2023-8)
### Version 1.3.2 - *28 Jun 2023*[🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-132-28-jun-2023-9)
### Version 1.3.1 - *10 Jun 2023* [🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-131-10-jun-2023-10)
### Version 1.3 - *9 Jun 2023* [🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-13-9-jun-2023-9)
### Version 1.2 - *30 May 2023* [🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-12-30-may-2023-10)
### Version 1.1 - *25 March 2023* [🔗](https://community.home-assistant.io/t/notification-with-confirm-dismiss-and-timeout/551552#version-11-25-march-2023-11)
</details>
### Known Issues
<details>
<summary>Expand/collapse known issues</summary>
- In some cases, iOS does not seem to play well with newer features.
If that happens to you, you can [check out older releases here](https://github.com/samuelthng/t-house-blueprints/releases).
- In some cases, some setups have difficulty receiving events from the device.
When this happens, no actions will be performed by Home Assistant.
You can test this:
- Navigate to Developer Tools → Events
- Listen to event: `mobile_app_notification_action`
- Trigger a notification to your device by running the script
- Select an action option
If you do not see an event appearing in the Events page, this could be the issue.
You might want to check the [troubleshooting documents](https://companion.home-assistant.io/docs/troubleshooting/faqs), or check your network configuration to resolve the issue.
</details>
### FAQ
<details>
<summary>Expand/collapse FAQ</summary>
- **_Will you add sending notifications to multiple devices?_**
Sadly, no. It is possible to send notifications to multiple devices, however, it will not work as well with the timeout feature and notifications clearing at this time.
I might revisit it in future, but not at this time.
- **_Why can't I see my devices or notify service?_**
You might want to check if troubleshooting steps provided by the [Home Assistant Companion app documentation](https://companion.home-assistant.io/docs/troubleshooting/faqs) may be able to help.
- **_Why do I keep receiving notifications incessantly?_**
Check your scripts and automation, there might be a logical loop going on that's triggering the notification over and over again. If you need further help, feel free to drop by the [main post](https://community.home-assistant.io/t/notifications-actionable-mobile-notifications-script-with-optional-timeout-feature-and-camera-snapshots-works-with-ios-android/) and share your automation and scripts yamls.
</details>
<br>
input:
##############################
# Input: Notification Strategy
##############################
notify_device:
name: "📲 Device to notify"
description: >-
Device needs to run the official [Home Assistant Companion](https://companion.home-assistant.io/) app to receive notifications.<br><br>
❔ Only used with `📲 Notification Strategy: Device`<br>
👍🏻 `Device` is the preferred and default option.
default: ""
selector:
device:
filter:
- integration: mobile_app
##############################
# Input: Notification Content
##############################
title:
name: "🏷️ Title"
description: "The title of the notification. \n\n`Optional`\n"
default: ""
selector:
text:
subtitle:
name: "🏷️ Subtitle"
description: "The subtitle of the notification. \n\n`Optional`\n"
default: ""
selector:
text:
message:
name: "💬 Message"
description: "The message body to display on the notification. \n\n`🤖 Android`: You may add [HTML formatting](https://companion.home-assistant.io/docs/notifications/notifications-basic?_highlight=tag#notification-message-html-formatting) to customise the look of the message."
selector:
text:
icon:
name: "🙂 Icon"
description: "Custom icon for this notification. \n\n`🤖 Android Only`, `Optional`"
default: ""
selector:
icon:
enable_icon_color:
name: "🎨 Use Icon Color"
description: "If disabled, uses default icon color. \n\n`🤖 Android Only`, `Optional`"
default: false
selector:
boolean:
icon_color:
name: "🎨 Icon Color"
description: "Custom icon color for this notification. \n\n`🤖 Android Only`, `Optional`"
default: [102, 186, 240]
selector:
color_rgb:
##############################
# Input: Response Options
##############################
## Option 1
confirm_enabled:
name: "1️⃣ Option 1"
description: "Show or hide this option."
default: True
selector:
boolean:
confirm_text:
name: "1️⃣ Option 1 - Title"
description: "Title to show on the first option."
default: "Option 1"
selector:
text:
confirm_option_mode:
name: "1️⃣ Option 1 - Mode"
description: >-
Action mode for this option.<br /><br />
If you need this option to do nothing, pick `Mode: Action(s)` here and leave the `Action(s)` input empty for this option.<br /><br />
<details>
<summary>❔ What is this?</summary>
This option is only applicable to Android due to technical limitations.
The android app can't sending events and open links on the device at the same time, using the same option.
As such, options on the android app can only be either a link, or an action on Home Assistant. Not both.
This is due to:
- The lack of events being sent when URI options are fired.
- The requirement to set the `action` parameter to `"URI"`.
</details>
iOS: Ignore this, iOS will run both actions and links if they are set.<br /><br />
`🤖 Android Only`, `Optional`
default: ""
selector:
select:
mode: dropdown
options:
- label: ""
value: ""
- label: Action(s)
value: action
- label: "Link (🤖 Android Only)"
value: uri
confirm_action:
name: "1️⃣ Option 1 - Action(s)"
description: "Action(s) to run when this option is selected.\n\n❔ Used with `Mode: Action(s)` option\n❔ Script stops after actions are run\n❔ Leave empty to do nothing\n\n`Optional`"
default: []
selector:
action:
confirm_uri:
name: "1️⃣ Option 1 - Link"
description: >-
Navigate to a link or app when this option is selected.<br />
<details>
<summary>🔗 Show Common Examples</summary>
- To **open a Home Assistant view**, use relative links like these:
`/lovelace/my-dashboard`
`/config/dashboard`
`/developer-tools/template`
- Use **launch a page in your default browser**,
select the appropriate `Link` option in modes and enter a URL here:
`https://example.com`
</details><br />
<details>
<summary>🤖 Show Android Specific Examples</summary>
- To **open an Application** on your device, for example:
`app://<android application package name>`
`app://io.homeassistant.companion.android`
- To **view an Entity** on your Home Assistant setup:
`entityId:<your_entity_id>`
`entityId:sun.sun`
- To use [**Intent scheme URIs**](https://developer.chrome.com/docs/multidevice/android/intents/#syntax):
`intent://scan/#Intent;scheme=zxing;package=com.my.pkg;end`
- To use [**Deep links**](https://developer.android.com/training/app-links#deep-links):
`deep-link://<deep_link_here>`
`deep-link://example://link/to/content`
- To **see notification history**:
`settings://notification_history`
</details><br />
<details>
<summary> Show iOS Specific Examples</summary>
- Use **application-launching URLs** on your device
`tel:123456789`
`mailto:[email protected]`
</details><br />
❔ Android: Used with `Mode: Link` options<br />
❔ iOS: Leave empty to disable<br />
⚠️ Android: Using this option **WILL NOT STOP** timeout countdown. Please triple check actions that will be run in `Timeout Action(s)`.<br /><br />
`Optional`
default: ""
selector:
text:
type: url
confirm_icon:
name: "1️⃣ Option 1 - Icon"
description: "Custom icon to show on this option. \n\nPlease refer to the [documentation here](https://companion.home-assistant.io/docs/notifications/actionable-notifications#icon-values). \nThere are many reference pages out there, feel use a [search engine](https://www.google.com/search?q=sfsymbols+reference+list)! \n\n` iOS Only`, `Optional`"
default: ""
selector:
text:
prefix: "sfsymbols:"
confirm_is_destructive:
name: "1️⃣ Option 1 - Destructive"
description: "Set the action's title to be red, indicating a destructive action. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
confirm_authentication_required:
name: "1️⃣ Option 1 - Authentication Required"
description: "Require device to be unlocked to use this option. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
## Option 2
dismiss_enabled:
name: "2️⃣ Option 2"
description: "Show or hide this option."
default: True
selector:
boolean:
dismiss_text:
name: "2️⃣ Option 2 - Title"
description: "Title to show on the first option."
default: "Option 2"
selector:
text:
dismiss_option_mode:
name: "2️⃣ Option 2 - Mode"
description: >-
Action mode for this option.<br /><br />
If you need this option to do nothing, pick `Mode: Action(s)` here and leave the `Action(s)` input empty for this option.<br /><br />
<details>
<summary>❔ What is this?</summary>
This option is only applicable to Android due to technical limitations.
The android app can't sending events and open links on the device at the same time, using the same option.
As such, options on the android app can only be either a link, or an action on Home Assistant. Not both.
This is due to:
- The lack of events being sent when URI options are fired.
- The requirement to set the `action` parameter to `"URI"`.
</details>
iOS: Ignore this, iOS will run both actions and links if they are set.<br /><br />
`🤖 Android Only`, `Optional`
default: ""
selector:
select:
mode: dropdown
options:
- label: ""
value: ""
- label: Action(s)
value: action
- label: "Link (🤖 Android Only)"
value: uri
dismiss_action:
name: "2️⃣ Option 2 - Action(s)"
description: "Action(s) to run when this option is selected.\n\n❔ Used with `Mode: Action(s)` option\n❔ Script stops after actions are run\n❔ Leave empty to do nothing\n\n`Optional`"
default: []
selector:
action:
dismiss_uri:
name: "2️⃣ Option 2 - Link"
description: >-
Navigate to a link or app when this option is selected.<br />
<details>
<summary>🔗 Show Common Examples</summary>
- To **open a Home Assistant view**, use relative links like these:
`/lovelace/my-dashboard`
`/config/dashboard`
`/developer-tools/template`
- Use **launch a page in your default browser**,
select the appropriate `Link` option in modes and enter a URL here:
`https://example.com`
</details><br />
<details>
<summary>🤖 Show Android Specific Examples</summary>
- To **open an Application** on your device, for example:
`app://<android application package name>`
`app://io.homeassistant.companion.android`
- To **view an Entity** on your Home Assistant setup:
`entityId:<your_entity_id>`
`entityId:sun.sun`
- To use [**Intent scheme URIs**](https://developer.chrome.com/docs/multidevice/android/intents/#syntax):
`intent://scan/#Intent;scheme=zxing;package=com.my.pkg;end`
- To use [**Deep links**](https://developer.android.com/training/app-links#deep-links):
`deep-link://<deep_link_here>`
`deep-link://example://link/to/content`
- To **see notification history**:
`settings://notification_history`
</details><br />
<details>
<summary> Show iOS Specific Examples</summary>
- Use **application-launching URLs** on your device
`tel:123456789`
`mailto:[email protected]`
</details><br />
❔ Android: Used with `Mode: Link` options<br />
❔ iOS: Leave empty to disable<br />
⚠️ Android: Using this option **WILL NOT STOP** timeout countdown. Please triple check actions that will be run in `Timeout Action(s)`.<br /><br />
`Optional`
default: ""
selector:
text:
type: url
dismiss_icon:
name: "2️⃣ Option 2 - Icon"
description: "Custom icon to show on this option. \n\nPlease refer to the [documentation here](https://companion.home-assistant.io/docs/notifications/actionable-notifications#icon-values). \nThere are many reference pages out there, feel use a [search engine](https://www.google.com/search?q=sfsymbols+reference+list)! \n\n` iOS Only`, `Optional`"
default: ""
selector:
text:
prefix: "sfsymbols:"
dismiss_is_destructive:
name: "2️⃣ Option 2 - Destructive"
description: "Set the action's title to be red, indicating a destructive action. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
dismiss_authentication_required:
name: "2️⃣ Option 2 - Authentication Required"
description: "Require device to be unlocked to use this option. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
## Option 3
option_three_enabled:
name: "3️⃣ Option 3"
description: "Show or hide this option."
default: false
selector:
boolean:
option_three_text:
name: "3️⃣ Option 3 - Title"
description: "Title to show on the first option."
default: "Option 3"
selector:
text:
option_three_option_mode:
name: "3️⃣ Option 3 - Mode"
description: >-
Action mode for this option.<br /><br />
If you need this option to do nothing, pick `Mode: Action(s)` here and leave the `Action(s)` input empty for this option.<br /><br />
<details>
<summary>❔ What is this?</summary>
This option is only applicable to Android due to technical limitations.
The android app can't sending events and open links on the device at the same time, using the same option.
As such, options on the android app can only be either a link, or an action on Home Assistant. Not both.
This is due to:
- The lack of events being sent when URI options are fired.
- The requirement to set the `action` parameter to `"URI"`.
</details>
iOS: Ignore this, iOS will run both actions and links if they are set.<br /><br />
`🤖 Android Only`, `Optional`
default: ""
selector:
select:
mode: dropdown
options:
- label: ""
value: ""
- label: Action(s)
value: action
- label: "Link (🤖 Android Only)"
value: uri
option_three_action:
name: "3️⃣ Option 3 - Action(s)"
description: "Action(s) to run when this option is selected.\n\n❔ Used with `Mode: Action(s)` option\n❔ Script stops after actions are run\n❔ Leave empty to do nothing\n\n`Optional`"
default: []
selector:
action:
option_three_uri:
name: "3️⃣ Option 3 - Link"
description: >-
Navigate to a link or app when this option is selected.<br />
<details>
<summary>🔗 Show Common Examples</summary>
- To **open a Home Assistant view**, use relative links like these:
`/lovelace/my-dashboard`
`/config/dashboard`
`/developer-tools/template`
- Use **launch a page in your default browser**,
select the appropriate `Link` option in modes and enter a URL here:
`https://example.com`
</details><br />
<details>
<summary>🤖 Show Android Specific Examples</summary>
- To **open an Application** on your device, for example:
`app://<android application package name>`
`app://io.homeassistant.companion.android`
- To **view an Entity** on your Home Assistant setup:
`entityId:<your_entity_id>`
`entityId:sun.sun`
- To use [**Intent scheme URIs**](https://developer.chrome.com/docs/multidevice/android/intents/#syntax):
`intent://scan/#Intent;scheme=zxing;package=com.my.pkg;end`
- To use [**Deep links**](https://developer.android.com/training/app-links#deep-links):
`deep-link://<deep_link_here>`
`deep-link://example://link/to/content`
- To **see notification history**:
`settings://notification_history`
</details><br />
<details>
<summary> Show iOS Specific Examples</summary>
- Use **application-launching URLs** on your device
`tel:123456789`
`mailto:[email protected]`
</details><br />
❔ Android: Used with `Mode: Link` options<br />
❔ iOS: Leave empty to disable<br />
⚠️ Android: Using this option **WILL NOT STOP** timeout countdown. Please triple check actions that will be run in `Timeout Action(s)`.<br /><br />
`Optional`
default: ""
selector:
text:
type: url
option_three_icon:
name: "3️⃣ Option 3 - Icon"
description: "Custom icon to show on this option. \n\nPlease refer to the [documentation here](https://companion.home-assistant.io/docs/notifications/actionable-notifications#icon-values). \nThere are many reference pages out there, feel use a [search engine](https://www.google.com/search?q=sfsymbols+reference+list)! \n\n` iOS Only`, `Optional`"
default: ""
selector:
text:
prefix: "sfsymbols:"
option_three_is_destructive:
name: "3️⃣ Option 3 - Destructive"
description: "Set the action's title to be red, indicating a destructive action. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
option_three_authentication_required:
name: "3️⃣ Option 3 - Authentication Required"
description: "Require device to be unlocked to use this option. \n\n` iOS Only`, `Optional`"
default: false
selector:
boolean:
##############################
# Input: Timeout Options
##############################
enable_timeout:
name: "⌛️ Enable Timeout"
description: "Require script to stop listening after the set duration.<br><br>👍🏻 Recommended to enable.<br>⚠️ If disabled, script will wait for response indefinitely until the next time it is triggered."
default: true # Default `true` for backward compatibility.
selector:
boolean:
timeout:
name: "⌛️ Timeout Duration"
description: "Amount of time to wait for an action response before firing timeout action. \n\n👍🏻 Recommended: ≥1 minute, to allow notifications to be sent. \nDefault: 15 minutes. \n"
default:
hours: 0
minutes: 15
seconds: 0
selector:
duration:
enable_day: false
run_timeout_actions:
name: "⌛️ Enable Timeout Action(s)"
description: "Run timeout actions upon a timeout event.<br><br>👍🏻 Recommended to enable.<br>⚠️ If disabled, script will timeout without executing any timeout actions."
default: true # Default `true` for backward compatibility.
selector:
boolean:
timeout_action:
name: "⌛️ Timeout Action(s)"
description: "Action to run when notification response is timed out. \n\n❔ Leave empty if no actions should be run \n\n⚠️ Android Users: Note, URI options do not stop the timeout countdown. This action could be run after pressing the URI option.\n❔ Android Users: Workaround for the above, you may disable `⌛️ Run timeout action(s) when notification cleared` and manually clear the notification after selecting your URI option. \n\n`Optional`"
default: []
selector:
action:
swipe_away_as_timeout:
name: "⌛️ Run timeout action(s) when notification cleared"
description: "If enabled, swiping the notification away will immediately trigger timeout actions. \n\n`🤖 Android Only`"
default: false
selector:
boolean:
clear_on_timeout:
name: "🧹 Clear notification on timeout"
description: "Dismiss the notification after action selection times out."
default: false
selector:
boolean:
persist:
name: "🚩 Persistent Notification"
description: "Prevents notifications from being swiped away by accident. \n\n❔ This option blocks `⌛️ Run timeout action(s) when notification cleared` \n\n`🤖 Android Only`"
default: false
selector:
boolean:
##############################
# Input: Notification Link
##############################
notification_link:
name: "🔗 Notification Link"
description: "Link to navigate to upon clicking the notification. \n\n Examples: \n - Home Assistant relative links: `/config/updates` or `/lovelace/home` \n - Apps: `app://<package name>` \n - Entity `More Info` Panel: `entityId:<entity_ID>` \n - Deep links: `deep-link://<deep_link>` \n\nSee [documentation](https://companion.home-assistant.io/docs/notifications/notifications-basic/#opening-a-url) for more information and options. \n\n`Optional`"
default: ""
selector:
text:
##############################
# Input: Attachments
##############################
attachment_type:
name: "📸 Attachment Type"
description: >
Choose to send an attachment along with the notification.<br>
`Optional`
default: "none"
selector:
select:
options:
- label: "None"
value: "none"
- label: "Camera"
value: "camera_entity"
attachment_camera_entity:
name: "📸 Attachment: Camera Entity"
description: >-
Camera Entity to display snapshots of on the notification.<br>
Please note, iOS and Android have differing vehaviours, as specified in the documentation.
See the links below for more information.
<table><tr><td> <a target="_blank" href="https://companion.home-assistant.io/docs/notifications/dynamic-content#camera-stream"> Camera Stream</a></td><td> <a target="_blank" href="https://companion.home-assistant.io/docs/notifications/notification-attachments#automatic-snapshots">🤖 Automatic Snapshots</a></td></tr></table><br>
❔ Only used with `Attachment Type: Camera`
default: ""
selector:
entity:
filter:
- domain: "camera"
##############################
# Input: Misc Inputs
##############################
car_ui:
name: "🚘 Show on Android Auto"
description: "Display notification on Android Auto interface. \n\n`🤖 Android Only`"
default: false
selector:
boolean:
tag:
name: "🔖 Tag"
description: "Used to uniquely identify the notification. \n\nUse tag if you are using this script with other notification services. \nLeave empty otherwise. \n\nExample: `my_awesome_notification_for_device_X` \n\n👍🏻 Recommended to leave empty\n\n`Optional`"
default: ""
selector:
text:
group:
name: "📣 Notification Group ID"
description: "Used for grouping different notifications together visually. \n\n⚠️ iOS critical notifications do no support grouping. \nSee [documentation](https://companion.home-assistant.io/docs/notifications/notifications-basic?_highlight=tag#grouping) for more information. \n\n`Optional`"
default: ""
selector:
text:
channel:
name: "📣 Notification Channel"
description: "Defines the channel, to be used with Importance. \nRelates to the importance of the notification. \n\n`🤖 Android Only`, `Optional`"
default: "General"
selector:
text:
importance:
name: "❕ Notification Channel Importance"
description: "See [documentation](https://companion.home-assistant.io/docs/notifications/notifications-basic/#notification-channel-importance) for more information. \n\n`🤖 Android Only`"
default: default
selector:
select:
options:
- label: "Urgent (Makes a sound with heads-up notification)"
value: high
- label: "Default (Makes a sound)"
value: default
- label: "Silent (Makes no sound)"
value: low
- label: "Low (Makes no sound, doesn't appear in status bar)"
value: min
android_high_priority:
name: "❕ High Priority Mode"
description: "Workaround to ensure notifications are delivered in timely fashion. This will override the Notification Channel Importance with `importance: high`, and set `ttl: 0`. \n\n`🤖 Android Only`"
default: true
selector:
boolean:
interruption_level:
name: "❕ Interruption Level"
description: "See [documentation](https://companion.home-assistant.io/docs/notifications/notifications-basic/#interruption-level) for more information. \n\n` iOS Only`"
default: active
selector:
select:
options:
- label: "Silent (Makes no sound, does not wake screen)"
value: passive
- label: "Default"
value: active
- label: "Important (Overrides Focus)"
value: time-sensitive
- label: "Critical (Overrides Focus and Mute, restricted features)"
value: critical
visibility:
name: "🔏 Notification Lockscreen Visibility"
description: "Show or hide notification content on the lockscreen. \nSee [documentation](https://companion.home-assistant.io/docs/notifications/notifications-basic?_highlight=tag#notification-sensitivity--lock-screen-visibility) for more information. \n\nDefault: `Private` \n\n`🤖 Android Only`"
default: "private"
selector:
select:
options:
- label: "Public: Always show content."
value: public
- label: "Private: Show content based on phone settings."
value: private
- label: "Secret: Always hide content on the lockscreen."
value: secret
##############################
# Fields
##############################
fields:
field_notify_device:
name: "📲 Device to notify"
description: Override device to be notified.
default: !input notify_device
selector:
device:
filter:
- integration: mobile_app
field_title:
name: "🏷️ Title"
description: "Override title of the notification."
example: !input title
default: !input title
selector:
text:
field_message:
name: "💬 Message"
description: "Override message body to display on the notification."
example: !input message
default: !input message
selector:
text:
field_subtitle:
name: "🏷️ Subtitle"
description: "Override subtitle of the notification."
example: !input subtitle
default: !input subtitle
selector:
text:
field_attachment_type:
name: "📸 Attachment Type"
description: "Override the Attachment Type of the notification."
example: !input attachment_type
default: !input attachment_type
selector:
select:
options:
- label: "None"
value: "none"
- label: "Camera"
value: "camera_entity"
field_attachment_camera_entity:
name: "📸 Attachment: Camera Entity"
description: "Override camera entity if your script has attachment type set to Camera."
example: !input attachment_camera_entity
default: !input attachment_camera_entity
selector:
entity:
filter:
- domain: "camera"
field_option_one_enabled:
name: "1️⃣ Option 1"
description: "Override showing or hiding this option."
example: !input confirm_enabled
selector:
boolean:
# [Unsupported due to `choose.sequence`] - Can't pass variables to choose.sequence.
# field_option_one_action:
# name: "1️⃣ Option 1 - Action(s)"
# description: "Override actions for this option."
# example: >-
# - alias: This is an example action
# service: homeassistant.check_config
# default: !input confirm_action
# selector:
# action:
field_option_two_enabled:
name: "2️⃣ Option 2"
description: "Override showing or hiding this option."
example: !input dismiss_enabled
selector:
boolean:
# [Unsupported due to `choose.sequence`] - Can't pass variables to choose.sequence.
# field_option_two_action:
# name: "1️⃣ Option 2 - Action(s)"
# description: "Override actions for this option."
# example: >-
# - alias: This is an example action
# service: homeassistant.check_config
# default: !input dismiss_action
# selector:
# action:
field_option_three_enabled:
name: "3️⃣ Option 3"
description: "Override showing or hiding this option."
example: !input dismiss_enabled
selector:
boolean:
# [Unsupported due to `choose.sequence`] - Can't pass variables to choose.sequence.
# field_option_three_action:
# name: "1️⃣ Option 3 - Action(s)"
# description: "Override actions for this option."
# example: >-
# - alias: This is an example action
# service: homeassistant.check_config
# default: !input option_three_action
# selector:
# action:
field_enable_timeout:
name: "⌛️ Enable Timeout"
description: "Override timeout feature."
example: !input enable_timeout
selector:
boolean:
field_timeout:
name: "⌛️ Timeout Duration"
description: "Override timeout duration"
default: !input timeout
selector:
duration:
enable_day: false
field_run_timeout_actions:
name: "⌛️ Enable Timeout Action(s)"
description: "Override running timeout actions"
example: !input run_timeout_actions
selector:
boolean:
field_notification_link:
name: "🔗 Notification Link"
description: "Override notification link"
example: !input notification_link
default: !input notification_link
selector:
text:
# [Unsupported due to `choose.sequence`] - Can't pass variables to choose.sequence.
# field_timeout_action:
# name: "⌛️ Timeout Action(s)"
# description: "Override timeout action."
# example: >-
# - alias: This is an example action
# service: homeassistant.check_config
# default: !input timeout_action
# selector:
# action:
sequence:
##############################
# Setup Variables
##############################
- alias: Basic Notification Content
variables:
# Title
script_title: !input title
title: "{{ iif(field_title is defined, field_title, script_title) }}"
# Subtitle
script_subtitle: !input subtitle
subtitle: "{{ iif(field_subtitle is defined, field_subtitle, script_subtitle) }}"
# Message
script_message: !input message
message: "{{ iif(field_message is defined and (field_message|length), field_message, script_message) }}"
- alias: Common Configuration Options
variables:
# [Opening a URL] - https://companion.home-assistant.io/docs/notifications/notifications-basic/#opening-a-url
script_notification_link: !input notification_link
notification_link: "{{ iif(field_notification_link is defined, field_notification_link, script_notification_link) }}"
# [Tag]
custom_tag: !input tag # No need for manual definition anymore, treat existing definitions as custom tags.
tag: "{{ iif(custom_tag|length, custom_tag, this.entity_id ~ '-' ~ context.id) }}"
# [Grouping]
group: !input group
- alias: Android Configuration Options
variables:
# sticky: !input sticky # Unlikely to support due to potential for users thinking that notifications are stuck.
channel: !input channel
visibility: !input visibility
importance: !input importance
persist: !input persist
# chronometer: !input chronometer # Unlikely to support, depends on template flexibility
# alert_once: !input alert_once
car_ui: !input car_ui
# [Notification Banner Icon]
notification_icon: !input icon
enable_icon_color: !input enable_icon_color
icon_color_selector: !input icon_color
icon_color_hex: '{{ "#{:02x}{:02x}{:02x}".format(icon_color_selector[0], icon_color_selector[1], icon_color_selector[2]) }}'
android_high_priority: !input android_high_priority
- alias: iOS Configuration Options
variables:
interruption_level: !input interruption_level
# presentation_options: !input presentation_options
# shortcut: !input shortcut # Unlikely to be supported due to complexity.
# [Critical Notifications] - https://companion.home-assistant.io/docs/notifications/critical-notifications
# critical: !input critical
# volume: !input volume
- alias: Timeout
variables:
script_enable_timeout: !input enable_timeout
enable_timeout: "{{ iif(field_enable_timeout is defined, field_enable_timeout, script_enable_timeout) }}"
clear_on_timeout: !input clear_on_timeout
script_timeout: !input timeout # Load timeout into variable for use with templates.
timeout: "{{ iif(field_timeout is defined, field_timeout, script_timeout) }}"
timeout_seconds: "{{ (timeout.hours * 60 + timeout.minutes) * 60 + timeout.seconds }}"
script_run_timeout_actions: !input run_timeout_actions
run_timeout_actions: "{{ iif(field_run_timeout_actions is defined, field_run_timeout_actions, script_run_timeout_actions) }}"
swipe_away_as_timeout: !input swipe_away_as_timeout
- alias: Attachments
variables:
script_attachment_type: !input attachment_type
attachment_type: "{{ iif(field_attachment_type is defined, field_attachment_type, script_attachment_type) }}"
script_attachment_camera_entity: !input attachment_camera_entity
attachment_camera_entity: "{{ iif(field_attachment_camera_entity is defined, field_attachment_camera_entity, script_attachment_camera_entity) }}"
camera_image_url: >-
{% if (attachment_camera_entity|length) %}
{% if (state_attr(attachment_camera_entity,'entity_picture')|length) %}
{{state_attr(attachment_camera_entity,'entity_picture')}}
{% else %}
{{"/api/camera_proxy/{id}".format(id=attachment_camera_entity)}}
{%- endif %}
{%- endif %}
media_url: >-
{{
{
'none': '',
'camera_entity': iif(camera_image_url | length, camera_image_url)
}.get(attachment_type)
}}