Chromecast Radio with station and player selection

If you haven’t already, setup the package folder / file

Place this in the yaml file:

input_select:
  radio_station:
    name: 'Select Radio Station:'
    options:
      - Hit 92-9
      - Nova 93-7
      - Mix 94-5
      - 96FM
      - 80's 1
      - 80's 2
      - OldSkool Hits
      - Old Skool Anthems
      - Raw FM (dance)
      - 181FM Power (Todays Hits)
      - 181FM 90's Dance
      - 181FM Star 90's
      - 181FM The Breeze
      - Heat Radio (RnB)
      - Fresh 92-7
      - DI Chill & Tropical House
      - DI Disco House
      - DI Funky House
      - DI Liquid D&B
      - Aloha Joe's Relaxation Island
      - Spectrum Fit
      - Energy FM Australia
      - Jazz Relax
      - Australian Country
      - Rebel FM
    initial: Raw FM (dance)
    icon: mdi:radio

    

  chromecast_radio:
    name: 'Select Speakers:'
    options:
      - Lounge
      - Bedroom
      - Office
      - Lounge and Office
      - House
      - House except office
      - Everywhere
      - Everywhere except office
      - Back yard
    initial: House
    icon: mdi:speaker-wireless

input_number: 
  volume_radio:
    name: Volume
    icon: mdi:volume-high
    min: 0
    max: 1
    step: 0.05

automation:
  - alias: 'Listen Radio'
    trigger:
      - platform: state
        entity_id: input_select.radio_station
    action: 
      - service: script.radio

  - alias: 'Set Chromecast Radio Volume'
    trigger:
      platform: state
      entity_id: input_number.volume_radio
    action:
      service: media_player.volume_set
      data_template:
        entity_id: >
          {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.lounge_speakers
          {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
          {% elif is_state("input_select.chromecast_radio", "Office") %} media_player.chromecastaudio3249
          {% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
          {% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
          {% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
          {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
          {% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
          {% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
          {% endif %}
        volume_level: '{{  states.input_number.volume_radio.state  }}'

script:

  radio:
    alias: Play Radio on Chromecast Audio
    sequence:
    - service: media_player.volume_set
      data_template:
        entity_id: >
          {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.lounge_speakers
          {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
          {% elif is_state("input_select.chromecast_radio", "Office") %} media_player.chromecastaudio3249
          {% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
          {% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
          {% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
          {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
          {% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
          {% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
          {% endif %}
        volume_level: '{{  states.input_number.volume_radio.state  }}' 
    - service: media_player.play_media
      data_template:
        entity_id: >
          {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.lounge_speakers
          {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom
          {% elif is_state("input_select.chromecast_radio", "Office") %} media_player.chromecastaudio3249
          {% elif is_state("input_select.chromecast_radio", "Lounge and Office") %} media_player.lounge_and_office
          {% elif is_state("input_select.chromecast_radio", "House") %} media_player.house
          {% elif is_state("input_select.chromecast_radio", "House except office") %} media_player.house_except_office
          {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.everywhere
          {% elif is_state("input_select.chromecast_radio", "Everywhere except office") %} media_player.all_except_office
          {% elif is_state("input_select.chromecast_radio", "Back yard") %} media_player.back_yard
          {% endif %}
        media_content_id: >
          {% if is_state("input_select.radio_station", "Hit 92-9") %} http://ic6ti.scahw.com.au/6ppm_128
          {% elif is_state("input_select.radio_station", "Nova 93-7") %} http://streaming.novaentertainment.com.au/nova937
          {% elif is_state("input_select.radio_station", "Mix 94-5") %} http://sc01.scahw.com.au/6mix_32
          {% elif is_state("input_select.radio_station", "96FM") %} https://icy.ihrcast.arn.com.au/au_012_icy
          {% elif is_state("input_select.radio_station", "80's 1") %} http://ic2ti.scahw.com.au/2easy_128
          {% elif is_state("input_select.radio_station", "80's 2") %} http://18243.live.streamtheworld.com/T_RAD_80S_S01_SC?
          {% elif is_state("input_select.radio_station", "OldSkool Hits") %} http://sc01.scahw.com.au/loveland_32
          {% elif is_state("input_select.radio_station", "Old Skool Anthems") %} http://nebula.shoutca.st:8075/stream
          {% elif is_state("input_select.radio_station", "Raw FM (dance)") %} https://frontend.stream.rawfm.net.au/i/syd-stream-192k.mp3 
          {% elif 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", "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:80/freshaac
          {% 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 Funky House") %} http://pub1.diforfree.org:8000/di_funkyhouse_hi
          {% elif is_state("input_select.radio_station", "DI Liquid D&B") %} http://pub1.diforfree.org:8000/di_liquiddnb_hi
          {% elif is_state("input_select.radio_station", "Aloha Joe's Relaxation Island") %} http://s2.voscast.com:7932/
          {% elif is_state("input_select.radio_station", "Spectrum Fit") %} http://51.255.235.165:5292/
          {% elif is_state("input_select.radio_station", "Energy FM Australia") %} http://s3.viastreaming.net:8502/
          {% elif is_state("input_select.radio_station", "Jazz Relax") %} http://199.195.194.94:8036/stream
          {% elif is_state("input_select.radio_station", "Australian Country") %} https://streaming.radio.co/s5ea3fdd1c/listen
          {% elif is_state("input_select.radio_station", "Rebel FM") %} https://au1.fastcast4u.com/proxy/rblgc?mp=/stream
          {% endif %}
        media_content_type: 'audio/mp4'

Adjust the entity id’s for your media players accordingly, change the radio station URL’s to whatever you want etc.

In Lovelace add a card:

entities:
  - input_select.radio_station
  - input_select.chromecast_radio
  - script.radio
  - input_number.volume_radio
header:
  image: /local/images/internet_radio.jpg
  type: picture
show_header_toggle: false
type: entities

Save this file under: www\images\internet_radio.jpg

internet_radio

…and you should end up with this:
image

6 Likes