-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSCRIPT - Sonos Script for TTS Announcement - Start v3.txt
More file actions
174 lines (174 loc) · 5.47 KB
/
SCRIPT - Sonos Script for TTS Announcement - Start v3.txt
File metadata and controls
174 lines (174 loc) · 5.47 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
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
alias: Sonos Script for TTS Announcement - Start v3
description: >-
Complete Sonos announcement workflow with 13 automated steps. Takes snapshot,
groups speakers, plays MP3, and waits for completion. Perfect for appliance
notifications! For detailed documentation and step-by-step guide, visit your
Home Assistant at:
http://192.168.10.60:8123/local/documentation/sonos_announcement_guide.html
fields:
group_leader:
name: 🎯 Group Leader
description: >
Main speaker that will lead the group and play the MP3. This speaker
becomes the master for the announcement group.
required: true
selector:
entity:
domain: media_player
integration: sonos
group_members:
name: 👥 Group Members
description: >
Additional speakers to include in the group (select one or more). All
selected speakers will play the announcement simultaneously in perfect
sync.
required: true
selector:
entity:
domain: media_player
multiple: true
integration: sonos
delay_after_snapshot:
name: ⏱️ Step 2 - Delay after Snapshot
description: >
Time to wait after taking snapshot before pausing speakers. Default 1.5s
works well for most setups.
required: true
default: 1.5
selector:
number:
min: 0.5
max: 5
step: 0.1
unit_of_measurement: seconds
delay_after_pause:
name: ⏱️ Step 4 - Delay after Pause
description: >
Time to wait after pausing before ungrouping speakers. Increase if you
experience grouping issues.
required: true
default: 1
selector:
number:
min: 0.5
max: 5
step: 0.1
unit_of_measurement: seconds
delay_after_unjoin:
name: ⏱️ Step 6 - Delay after Unjoin
description: >
Time to wait after ungrouping before creating new group. Critical for
stable grouping - don't set below 1.0s.
required: true
default: 1.5
selector:
number:
min: 0.5
max: 5
step: 0.1
unit_of_measurement: seconds
delay_after_join:
name: ⏱️ Step 8 - Delay after Join
description: >
Time to wait after grouping before setting volume. Ensures all speakers
are ready before volume adjustment.
required: true
default: 1.5
selector:
number:
min: 0.5
max: 5
step: 0.1
unit_of_measurement: seconds
volume:
name: 🔊 Step 9 - Set Volume
description: >
Volume level for announcement (0.0 = muted, 1.0 = maximum). Recommended:
0.3 for normal announcements, 0.5 for important alerts.
required: true
default: 0.3
selector:
number:
min: 0
max: 1
step: 0.01
final_delay:
name: ⏱️ Step 10 - Final Delay
description: >
Time to wait after setup is complete before MP3 playback starts. Final
buffer to ensure perfect synchronization.
required: true
default: 1
selector:
number:
min: 0
max: 3
step: 0.1
unit_of_measurement: seconds
mp3_url:
name: 🎵 Step 11 - MP3 File URL/Path
description: >
Enter the full URL or path to the MP3 file you want to play. Examples:
http://192.168.1.100:8123/local/your_announcement.mp3 or
/local/your_announcement.mp3 The file should be placed in the www folder
of your Home Assistant configuration. Need a custom MP3? Generate
high-quality announcements at https://fliki.ai/voices
required: true
default: http://192.168.10.60:8123/local/vaskemaskinen_er_faerdig.mp3
selector:
text: null
mp3_duration:
name: ⏰ Step 12 - Wait for MP3 Completion
description: >
Length of your MP3 file plus 1 second buffer to ensure complete playback.
Set this to your MP3 duration + 1 second so the announcement finishes
completely before restore. Examples: 3s for 2-second files, 6s for
5-second files, 11s for 10-second files.
required: true
default: 3
selector:
number:
min: 1
max: 30
step: 0.5
unit_of_measurement: seconds
variables:
all_sonos: >
{{ expand(integration_entities('sonos')) | selectattr('domain', 'equalto',
'media_player') | map(attribute='entity_id') | list }}
speaker_list: |
{{ ([group_leader] + group_members) | unique | list }}
sequence:
- action: sonos.snapshot
data:
entity_id: "{{ all_sonos }}"
with_group: true
- delay: 00:00:{{ delay_after_snapshot | float }}
- action: media_player.media_pause
target:
entity_id: "{{ group_members }}"
- delay: 00:00:{{ delay_after_pause | float }}
- action: media_player.unjoin
data:
entity_id: "{{ all_sonos }}"
- delay: 00:00:{{ delay_after_unjoin | float }}
- action: media_player.join
data:
group_members: "{{ group_members }}"
target:
entity_id: "{{ group_leader }}"
- delay: 00:00:{{ delay_after_join | float }}
- action: media_player.volume_set
data:
volume_level: "{{ volume }}"
target:
entity_id: "{{ speaker_list }}"
- delay: 00:00:{{ final_delay | float }}
- action: media_player.play_media
data:
media_content_id: "{{ mp3_url }}"
media_content_type: music
target:
entity_id: "{{ group_leader }}"
- delay: 00:00:{{ mp3_duration | float }}
mode: single