Hi,
First post since embarking on the HA journey.
I have tried to follow others post/blogs with regards to list and helpers.
What I want to do is with two list, one holding my sonos players, the other the sources, choose from the list then play it on the correct sonos player.
I have looked at if…else statements but just can’t get the hang of it.
I have finally managed to get something working, emphasis on the something, but I know I should be able to make it more efficient.
My script is as follows, any help gratefully received…
G
sonos_stream_music:
alias: Sonos Stream Music
icon: hass:speaker-wireless
mode: single
sequence:
- data:
volume_level: 0.2
entity_id: media_player.office_play3
service: media_player.volume_set
- choose:
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Absolute 80s
sequence:
- data:
source: Absolute 80s
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Absolute Radio
- condition: and
conditions:
- condition: state
entity_id: input_select.sonos_players
state: Office
sequence:
- data:
source: Absolute Radio
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Absolute Radio 90s
sequence:
- data:
source: Absolute Radio 90s
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Apple Music 1
sequence:
- data:
source: Apple Music 1
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Apple Music Country
sequence:
- data:
source: Apple Music Country
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Apple Music Hits
sequence:
- data:
source: Apple Music Hits
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 1
sequence:
- data:
source: BBC Radio 1
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 2
sequence:
- data:
source: BBC Radio 2
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 4
sequence:
- data:
source: BBC Radio 4
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 5 Live
sequence:
- data:
source: BBC Radio 5 Live
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 5 Live Sports Extra
sequence:
- data:
source: BBC Radio 5 Live Sports Extra
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio 6 Music
sequence:
- data:
source: BBC Radio 6 Music
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: BBC Radio Scotland
sequence:
- data:
source: BBC Radio Scotland
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Classic Folk & Singer-Songwriters
sequence:
- data:
source: Classic Folk & Singer-Songwriters
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Classic Rock
sequence:
- data:
source: Classic Rock
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Classic Singer/Songwriter
sequence:
- data:
source: Classic Singer/Songwriter
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Disney
sequence:
- data:
source: Disney
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Frozen Radio
sequence:
- data:
source: Frozen Radio
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Modern Country
sequence:
- data:
source: Modern Country
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Northsound 1
sequence:
- data:
source: Northsound 1
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Northsound 2
sequence:
- data:
source: Northsound 2
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Rock
sequence:
- data:
source: Rock
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Rock Pantheon
sequence:
- data:
source: Rock Pantheon
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Scala Radio
sequence:
- data:
source: Scala Radio
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Singer/Songwriter
sequence:
- data:
source: Singer/Songwriter
entity_id: media_player.office_play3
service: media_player.select_source
- conditions:
- condition: state
entity_id: input_select.radio_stations
state: Virgin Radio
sequence:
- data:
source: Virgin Radio
entity_id: media_player.office_play3
service: media_player.select_source
default:
- data:
source: Absolute Radio
entity_id: media_player.office_play3
service: media_player.select_source