-
Notifications
You must be signed in to change notification settings - Fork 2
/
Configuration Entries.yaml
231 lines (224 loc) · 8.9 KB
/
Configuration Entries.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
# These sensors hold the master speaker selected by the Input Select in the "Sonos Master Card". The sensor allows the button to stay lit when "on".
binary_sensor:
platform: template
sensors:
sonos_master_deck:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_deck') }}
sonos_master_garage:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_garage') }}
sonos_master_living_room:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_living_room') }}
sonos_master_lounge:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_lounge') }}
sonos_master_office:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_office') }}
sonos_master_portable:
value_template: >-
{{ is_state('input_select.sonos_master', 'media_player.sonos_portable') }}
# Holds the status of the sonos group switches; not sure these are actually needed. May only be to keep the buttons lit on the Group card
input_boolean:
group_sonos_deck:
name: Group with Deck
icon: mdi:speaker-multiple
group_sonos_garage:
name: Group with Garage
icon: mdi:speaker-multiple
group_sonos_living_room:
name: Group with Living Room
icon: mdi:speaker-multiple
group_sonos_lounge:
name: Group with Lounge
icon: mdi:speaker-multiple
group_sonos_office:
name: Group with Office
icon: mdi:speaker-multiple
group_sonos_portable:
name: Group with Portable
icon: mdi:speaker-multiple
input_select:
# These input select options MUST match the names of your sonos speakers. The Sonos Master Card buttons select the proper input.
sonos_master:
name: Sonos Master Speaker
options:
- media_player.sonos_deck
- media_player.sonos_garage
- media_player.sonos_living_room
- media_player.sonos_lounge
- media_player.sonos_office
- media_player.sonos_portable
initial: media_player.sonos_living_room
# These input select options MUST match the names of your sources. The Sonos Playlist Card buttons select the input and execute a script based on this input
sonos_playlist:
name: Sonos Playlist
options:
- None
- "'80s on 8 - xmplaylist.com"
- "'90s on 9 - xmplaylist.com"
- 1st Wave - xmplaylist.com
- 70s Road Trip
- Cosco's Album of the Week
- Cosco Pop
- Cosco R&B
- family rock
- State of Jazz
- The Jack Bowen
- WBL Revisited
- Your Top Songs 2019
# This script takes the playlist passed by the Sonos Playlist Card, sets the playlist input select, and plays the selected playlist on the selected master speaker
script:
play_sonos:
alias: Play Sonos
sequence:
- service: input_select.select_option
data:
entity_id: input_select.sonos_playlist
option: "{{ playlist }}"
- service: media_player.shuffle_set
data_template:
entity_id: "{{ states.input_select.sonos_master.state }}"
shuffle: "{{shuffle}}"
- service: media_player.select_source
data_template:
entity_id: "{{ states.input_select.sonos_master.state }}"
source: "{{ states.input_select.sonos_playlist.state }}"
# this can be excluded. It sets the function on my Harmony remote to control Sonos volume if my Playbar is the master
- condition: state
entity_id: input_select.sonos_master
state: 'media_player.sonos_living_room'
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Listen To Sonos'
# This switch is toggled by the Sonos Group Card buttons. It turns on an input boolean and joins the selected speaker to the master
switch:
platform: template
switches:
group_sonos_deck:
value_template: "{{ is_state('input_boolean.group_sonos_deck', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_deck
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_deck
- service: media_player.volume_set
data:
entity_id: media_player.sonos_deck
volume_level: 0.5
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_deck
- service: sonos.unjoin
data:
entity_id: media_player.sonos_deck
group_sonos_garage:
value_template: "{{ is_state('input_boolean.group_sonos_garage', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_garage
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_garage
- service: media_player.volume_set
data:
entity_id: media_player.sonos_garage
volume_level: 0.3
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_garage
- service: sonos.unjoin
data:
entity_id: media_player.sonos_garage
group_sonos_living_room:
value_template: "{{ is_state('input_boolean.group_sonos_living_room', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_living_room
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_living_room
- service: media_player.volume_set
data:
entity_id: media_player.sonos_deck
volume_level: 0.2
- service: remote.turn_on
data:
entity_id: remote.living_room
activity: 'Listen To Sonos'
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_living_room
- service: sonos.unjoin
data:
entity_id: media_player.sonos_living_room
group_sonos_lounge:
value_template: "{{ is_state('input_boolean.group_sonos_lounge', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_lounge
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_lounge
- service: media_player.volume_set
data:
entity_id: media_player.sonos_lounge
volume_level: 0.2
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_lounge
- service: sonos.unjoin
data:
entity_id: media_player.sonos_lounge
group_sonos_office:
value_template: "{{ is_state('input_boolean.group_sonos_office', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_office
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_office
- service: media_player.volume_set
data:
entity_id: media_player.sonos_office
volume_level: 0.2
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_office
- service: sonos.unjoin
data:
entity_id: media_player.sonos_office
group_sonos_portable:
value_template: "{{ is_state('input_boolean.group_sonos_portable', 'on') }}"
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.group_sonos_portable
- service: sonos.join
data_template:
master: "{{ states.input_select.sonos_master.state }}"
entity_id:
- media_player.sonos_portable
- service: media_player.volume_set
data:
entity_id: media_player.sonos_portable
volume_level: 0.2
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.group_sonos_portable
- service: sonos.unjoin
data:
entity_id: media_player.sonos_portable