-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsend_notification.yaml
More file actions
executable file
·122 lines (116 loc) · 4.61 KB
/
Copy pathsend_notification.yaml
File metadata and controls
executable file
·122 lines (116 loc) · 4.61 KB
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
---
alias: send_notification
description: >
Automatically send a notification to one or more
devices, based on our presence and states of other devices.
mode: parallel
max: 100
fields:
message:
description: The message that needs to be sent to the receivers
title:
description: Title of the message
emoji:
description: The emoji to be used for the mobile notification
receivers:
description: List of people that need to receive the notification
type:
description: Type of the notification, default 'normal'
image:
description: (Optional) Image URL to show in the notification
video:
description: (Optional) Video URL to show in the notification
variables:
type: "{{ type | default('normal') }}"
image: "{{ image | default('None') }}"
video: "{{ video | default('None') }}"
home_status: ["Thuis", "Net Thuis"]
away_status: ["Weg", "Net weg", "Lang weg"]
laura_state: "{{ states('input_select.laura_status_dropdown') }}"
marvin_state: "{{ states('input_select.marvin_status_dropdown') }}"
sequence:
- repeat:
count: "{{ receivers | length }}"
sequence:
- variables:
receiver: "{{ receivers[repeat.index-1] }}"
name: "{{ receiver[0] | upper }}{{ receiver[1:] }}"
title: "{{ title | default('Hey') }} {{ name }}!"
# Check if we need to notify the mancave TV
- choose:
- conditions:
- condition: state
entity_id:
- media_player.mancave_tv
state: "on"
- "{{ receiver == 'marvin' }}"
- "{{ marvin_state in home_status }}"
sequence:
- service: notify.mancave_tv
continue_on_error: true
data:
message: "{{ emoji | default('') }} {{ message }}"
title: "{{ title }}"
data:
image: "{{ image }}"
video: "{{ video }}"
# Send notification to the intercom via TTS and MA
# Check woonkamer wakkker
- choose:
- conditions:
- "{{ receiver == 'intercom' }}"
sequence:
- if:
- condition: state
entity_id: input_select.livingroom_room_mode
state: "Wakker"
- not:
- condition: state
entity_id: media_player.living_room_android
state: "on"
then:
- action: conversation.process
data:
agent_id: conversation.chatgpt
text: >-
Herschrijf de content van de volgende smart home notificatie en geef er
je eigen draai aan. Antwoord alleen met de content tussen " ":
{{ message }}
response_variable: response
- action: tts.speak
target:
entity_id: tts.openai_gpt_4o_mini_tts
data:
cache: true
language: nl
message: "{{ response.response.speech.plain.speech.lower() }}"
media_player_entity_id: '{{ states("sensor.mass_media_entity") }}'
# Send mobile notifications
- choose:
- conditions: "{{ receiver == 'marvin'
and (type == 'normal' or
(type == 'away_only' and marvin_state in away_status) or
(type == 'home_only' and marvin_state in home_status)
) }}"
sequence:
- service: notify.mobile_app_marvins_iphone_13_nieuw
data:
message: "{{ emoji | default('') }} {{ message }}"
title: "{{ title }}"
data:
image: "{{ image }}"
video: "{{ video }}"
- choose:
- conditions: "{{ receiver == 'laura'
and (type == 'normal' or
(type == 'away_only' and laura_state in away_status) or
(type == 'home_only' and laura_state in home_status)
) }}"
sequence:
- service: notify.mobile_app_iphone_van_l_a
data:
message: "{{ emoji | default('') }} {{ message }}"
title: "{{ title }}"
data:
image: "{{ image }}"
video: "{{ video }}"