I would like to set up Universal Media Player to replace an entities card I have currently set up for streaming radio to my speakers
The card currently looks like this
The card uses one script to identify the speaker destination and the radio station that we want to play
radio:
alias: radio
sequence:
- service: media_player.volume_set
target:
entity_id: media_player.sonos
data:
volume_level: 0.35
- service: media_player.volume_set
data:
volume_level: 0.3
target:
entity_id: media_player.bedroom
- service: media_player.volume_set
data:
volume_level: 0.2
target:
entity_id: media_player.sonos_2
- service: media_player.volume_set
data:
volume_level: 0.4
target:
entity_id: media_player.office
- service: media_player.play_media
data_template:
entity_id: '{% if is_state("input_select.home_radio", "Living Room") %} media_player.sonos_2
{% elif is_state("input_select.home_radio", "Basement") %} media_player.sonos
{% elif is_state("input_select.home_radio", "Bedroom") %} media_player.bedroom
{% elif is_state("input_select.home_radio", "Office") %} media_player.office
{% endif %}
'
media_content_id: '{% if is_state("input_select.radio_station", "The Mix - 101.9
FM") %} https://22973.live.streamtheworld.com/WTMXFM.mp3 {% elif is_state("input_select.radio_station",
"Q101 - 101.1 FM") %} https://playerservices.streamtheworld.com/api/livestream-redirect/WKQXFM.mp3
{% endif %}
'
media_content_type: music
mode: single
icon: mdi:play
Then to stop playing I’m using a second script thats"
radio_stop:
sequence:
- service: media_player.media_stop
data_template:
entity_id: '{% if is_state("input_select.home_radio", "Living Room") %} media_player.sonos_2
{% elif is_state("input_select.home_radio", "Basement") %} media_player.sonos
{% elif is_state("input_select.home_radio", "Bedroom") %} media_player.bedroom
{% elif is_state("input_select.home_radio", "Office") %} media_player.office
{% endif %}
'
mode: single
alias: radio_stop
icon: mdi:stop
The list of speakers and the radios stations are just input selects.
Can someone help me with the proper configuration?