-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamic_notifications.yaml
87 lines (74 loc) · 2.39 KB
/
dynamic_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
blueprint:
name: Dynamic Notifications
description: Send notifications based on presense detection and use triggers to clear them.
domain: script
author: jay-kub
input:
notify_group:
name: Who would you like to notify?
default:
entity_id: []
selector:
target:
entity:
domain: person
only_home:
name: Notify only if home?
description: Notifications will only be sent to people who are home.
default: false
selector:
boolean: {}
only_home_wait:
name: Notify when home?
description: People who are initially away will receive a notification when their state changes to home.
default: false
selector:
boolean: {}
clear_notifications:
name: Trigger to clear notifications?
description: The script will watch for the trigger below, and once triggered it will clear all notifications and stop the script.
default: false
selector:
boolean: {}
clear_notification_trigger:
name: "Trigger to Clear Notification"
description: "Leave empty if you don't want the notification to be cleared"
default: []
selector:
trigger:
notification_tag:
name: Notification Tag
description: This tag will be used by home assistant to track the notifications. Please ensure you haven't used the same tag in other automations.
default: ''
variables:
group: !input notify_group
n_tag: !input notification_tag
homegroup: "{% set home = namespace(group=[]) %}
{% set away = namespace(group=[]) %}
{% for index in group.entity_id %}
{% if is_state(index, 'home') %}
{% set home.group = home.group + [index] %}
{% else %}
{% set away.group = away.group + [index] %}
{% endif %}
{% endfor %}
{{ home.group }}"
awaygroup: " {% set home = namespace(group=[]) %}
{% set away = namespace(group=[]) %}
{% for index in group.entity_id %}
{% if is_state(index, 'home') %}
{% set home.group = home.group + [index] %}
{% else %}
{% set away.group = away.group + [index] %}
{% endif %}
{% endfor %}
{{ away.group }}"
sequence:
- service: notify.jake
data:
message: "Home: {{ homegroup }}. Away: {{ awaygroup }}."
# data:
# tag: trash
# notification_icon: mdi:trash-can-outline
enabled: true
mode: parallel