Help with radio

This works pretty ok.
The only thing is that all google devices starts and also chromecast regardless what i select.
How to limit to the speakers i want to select?

Also i get this error: “media type audio/mp4 is not supported”

radio:
    sequence:
      - service: media_player.volume_set
        data_template:
          entity_id: media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker, media_player.hallway
          volume_level: '{{  states.input_number.spotify_volume_all.state  }}'
      - service: media_player.select_source
        data_template:
          entity_id: input_select.speakers
          source: >
           {% if is_state("input_select.speakers", "All") %} media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker, media_player.hallway
           {% elif is_state("input_select.speakers", "Music") %} media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker
           {% elif is_state("input_select.speakers", "Living Room") %} media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker
           {% elif is_state("input_select.speakers", "Hallway") %} media_player.hallway
           {% elif is_state("input_select.speakers", "Kitchen") %} media_player.kitchen
           {% elif is_state("input_select.speakers", "V-rum Soffa Vänster") %} media_player.living_room_left
           {% elif is_state("input_select.speakers", "V-rum Soffa Höger") %} media_player.living_room_right
           {% elif is_state("input_select.speakers", "V-rum") %} media_player.living_room_speaker
           {% endif %}
      - service: media_player.play_media
        data_template:
          media_content_id: >
           {% if is_state("input_select.radio_station", "181FM Power (Todays Hits)") %} http://listen.181fm.com/181-power_128k.mp3?
           {% elif is_state("input_select.radio_station", "P3") %} http://sverigesradio.se/topsy/direkt/164-hi.mp3
           {% elif is_state("input_select.radio_station", "Ekot") %} http://sverigesradio.se/topsy/direkt/4540-hi.mp3
           {% elif is_state("input_select.radio_station", "P4") %} http://sverigesradio.se/topsy/direkt/212-hi.mp3
           {% elif is_state("input_select.radio_station", "K103") %} http://130.241.172.94:8080/icestream96.mp3.m3u
           {% elif is_state("input_select.radio_station", "Mix Megapol") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=mixmegapolgbg_instream_se_mp3
           {% elif is_state("input_select.radio_station", "Lugna favoriter") %} http://stream-ice.mtgradio.com:8080/stat_lugna_favoriter.m3u
           {% elif is_state("input_select.radio_station", "Bandit Rock") %} http://stream-ice.mtgradio.com:8080/stat_bandit.m3u
           {% elif is_state("input_select.radio_station", "NRJ") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=nrj_instreamtest_se_mp3
           {% elif is_state("input_select.radio_station", "Rockklassiker") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=rockklassiker_instream_se_mp3
           {% elif is_state("input_select.radio_station", "Svensk Pop") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=svenskpop_se_mp3
           {% elif is_state("input_select.radio_station", "Vinyl FM") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=vinylfm_instream_se_mp3
           {% elif is_state("input_select.radio_station", "181FM 90's Dance") %} http://listen.181fm.com/181-90sdance_128k.mp3
           {% elif is_state("input_select.radio_station", "181FM Star 90's") %} http://listen.181fm.com/181-star90s_128k.mp3
           {% elif is_state("input_select.radio_station", "181FM The Breeze") %} http://listen.181fm.com/181-breeze_128k.mp3
           {% elif is_state("input_select.radio_station", "Heat Radio (RnB)") %} http://174.37.159.206:8106/stream
           {% elif is_state("input_select.radio_station", "Fresh 92-7") %} http://live.fresh927.com.au/freshmp3
           {% elif is_state("input_select.radio_station", "DI Chill & Tropical House") %} http://pub1.diforfree.org:8000/di_chillntropicalhouse_hi
           {% elif is_state("input_select.radio_station", "DI Disco House") %} http://pub1.diforfree.org:8000/di_discohouse_hi
           {% elif is_state("input_select.radio_station", "DI Liquid D&B") %} http://pub1.diforfree.org:8000/di_liquiddnb_hi
           {% endif %}
          media_content_type: 'audio/mp4'

I don’t know what select_source does, but it doesn’t do what you think it does. Remove that, and add an entity_id to your play_media part.

It’s easiest to have the options of your input select to exactly match your media player names, then it would be:

service: media_player.play_media
data_template:
  entity_id: "media_player.{{states.YOUR _INPUT _SELECT.state}}"
  media_content_type: 'audio/mp4'
  media_content_id: YOUR_RADIO_STATION_TEMPLATE
1 Like

This worked

radio:
    sequence:
      - service: media_player.volume_set
        data_template:
          entity_id: media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker, media_player.hallway
          volume_level: '{{  states.input_number.spotify_volume_all.state  }}'
      - service: media_player.play_media
        data_template:
          entity_id: >
           {% if is_state("input_select.speakers", "All") %} media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker, media_player.hallway
           {% elif is_state("input_select.speakers", "Music") %} media_player.kitchen, media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker
           {% elif is_state("input_select.speakers", "Living Room") %} media_player.living_room_left, media_player.living_room_right, media_player.living_room_speaker
           {% elif is_state("input_select.speakers", "Hallway") %} media_player.hallway
           {% elif is_state("input_select.speakers", "Kitchen") %} media_player.kitchen
           {% elif is_state("input_select.speakers", "V-rum Soffa Vänster") %} media_player.living_room_left
           {% elif is_state("input_select.speakers", "V-rum Soffa Höger") %} media_player.living_room_right
           {% elif is_state("input_select.speakers", "V-rum") %} media_player.living_room_speaker
           {% endif %}
          media_content_id: >
           {% if is_state("input_select.radio_station", "181FM Power (Todays Hits)") %} http://listen.181fm.com/181-power_128k.mp3?
           {% elif is_state("input_select.radio_station", "P3") %} http://sverigesradio.se/topsy/direkt/164-hi.mp3
           {% elif is_state("input_select.radio_station", "Ekot") %} http://sverigesradio.se/topsy/direkt/4540-hi.mp3
           {% elif is_state("input_select.radio_station", "P4") %} http://sverigesradio.se/topsy/direkt/212-hi.mp3
           {% elif is_state("input_select.radio_station", "K103") %} http://130.241.172.94:8080/icestream96.mp3.m3u
           {% elif is_state("input_select.radio_station", "Mix Megapol") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=mixmegapolgbg_instream_se_mp3
           {% elif is_state("input_select.radio_station", "Lugna favoriter") %} http://stream-ice.mtgradio.com:8080/stat_lugna_favoriter.m3u
           {% elif is_state("input_select.radio_station", "Bandit Rock") %} http://stream-ice.mtgradio.com:8080/stat_bandit.m3u
           {% elif is_state("input_select.radio_station", "NRJ") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=nrj_instreamtest_se_mp3
           {% elif is_state("input_select.radio_station", "Rockklassiker") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=rockklassiker_instream_se_mp3
           {% elif is_state("input_select.radio_station", "Svensk Pop") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=svenskpop_se_mp3
           {% elif is_state("input_select.radio_station", "Vinyl FM") %} http://tx-bauerse.sharp-stream.com/http_live.php?i=vinylfm_instream_se_mp3
           {% elif is_state("input_select.radio_station", "181FM 90's Dance") %} http://listen.181fm.com/181-90sdance_128k.mp3
           {% elif is_state("input_select.radio_station", "181FM Star 90's") %} http://listen.181fm.com/181-star90s_128k.mp3
           {% elif is_state("input_select.radio_station", "181FM The Breeze") %} http://listen.181fm.com/181-breeze_128k.mp3
           {% elif is_state("input_select.radio_station", "Heat Radio (RnB)") %} http://174.37.159.206:8106/stream
           {% elif is_state("input_select.radio_station", "Fresh 92-7") %} http://live.fresh927.com.au/freshmp3
           {% elif is_state("input_select.radio_station", "DI Chill & Tropical House") %} http://pub1.diforfree.org:8000/di_chillntropicalhouse_hi
           {% elif is_state("input_select.radio_station", "DI Disco House") %} http://pub1.diforfree.org:8000/di_discohouse_hi
           {% elif is_state("input_select.radio_station", "DI Liquid D&B") %} http://pub1.diforfree.org:8000/di_liquiddnb_hi
           {% endif %}
          media_content_type: 'audio/mp4'