Chromecast Radio with station and player selection

yeah, but you cant use playlist files. You need a stream URL

I think someone has got playlists working by using

media_content_type: 'application/x-mpegurl'

But it does not seem to work for me. Chromecast gets stucked.

I had problems getting this to work with playlists/spotify and chromecast’s so ended up setting up Mopidy and Snapcast to stream everything. Its a bit of work, but worth it in the end. All controllable from my HADashboard tablet as well.

Hi Rob,

I am struggeling a little bit where to put what part (like script, group and input_select). Any feedback is welcome. Thanks!

This might give you some indication of where to put things :slight_smile:

create a ‘package’ and put it all in the one chromecast_radio.yaml file under the folder ‘packages’ and include the below in your config.yaml

homeassistant:
  packages: !include_dir_named packages

image

2 Likes

hi , i am new to HA but finding my way around slowly.
I am trying to integrate the above but having some difficulties.

i get an error on config page when checking config file
Configuration invalidCHECK CONFIG

Component not found: chromecast_radio

INFO:homeassistant.util.package:Attempting install of colorlog==3.1.4 Testing configuration at /config Failed config General Errors: - Component not found: chromecast_radio Successful config (partial)

3:13 PM components/hassio/init.py (ERROR)

Unable to find component chromecast_radio

3:12 PM loader.py (ERROR)

Please can someone help me i would really appreciate some guidance as to what i have done wrong.

Here is my configurations file , everything in that for now to simplify problem solving. When i run config check i now get the following errors.
Component not found: chromecast_radio
Component not found: customize
Component not found: radio538
Component not found: radio_station

################################################################################### 
#radio
radio_station:
    name: 'Select Radio Station:'
    options:
      - Radio 538
      - Q-Music
      - 3FM
      - 100% NL
      - Veronica
      - Sky Radio
      - Arrow Classic Rock
      - Classic FM
      - BNR Nieuwsradio
      - SLAM! Hardstyle
      - Sleep Radio
      - Ambient Sleeping Pill
      - Radio Art - Sleep
      - Ambi Nature Radio
      - Calm Radio - Sleep
      - Dinamo.FM Sleep
############################################  
  
chromecast_radio:
    name: 'Select Speakers:'
    options:
      - Lounge
      - Kitchen
      - Milla
      - Bedroom
      - Bose
      - Everywhere
    initial: Everywhere
    icon: mdi:speaker-wireless
    
#############################################################

radio538:
    alias: Play Radio on Chromecast Audio
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.googlehome_ensuite
          volume_level: '0.35'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.kitchen_google_mini
           volume_level: '0.20'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.bedroom_google_mini
           volume_level: '0.30'
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.googlehome_ensuite
            {% elif is_state("input_select.chromecast_radio", "Kitchen") %} media_player.kitchen_google_mini
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom_google_mini
            {% elif is_state("input_select.chromecast_radio", "Milla") %} media_player.googlehome7480
            {% elif is_state("input_select.chromecast_radio", "Bose") %} media_player.chromecast_speaker
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.all_speakers_2
            {% endif %}
           media_content_id: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
            {% elif is_state("input_select.radio_station", "Q-Music") %} http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3
            {% elif is_state("input_select.radio_station", "3FM") %} http://icecast.omroep.nl/3fm-bb-mp3
            {% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Sky Radio") %} http://8623.live.streamtheworld.com:80/SKYRADIOAAC_SC
            {% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
            {% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://vip-icecast.538.lw.triple-it.nl/WEB17_MP3
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Ambient Sleeping Pill") %} http://perseus.shoutca.st:8447/h
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %} http://live.radioart.com/fSleep.mp3
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% endif %}
           media_content_type: 'audio/mp4' 
          


customize:
    script.radio538:
    friendly_name: Start Playing
    icon: mdi:play

You probably try to use this as a package. If that is the case than your config is wrong.
You can’t just add

radio_station:
    name: 'Select Radio Station:'
    options: ...

this is input select so this is right config in package.

input_select:
  radio_station:
    name: 'Select Radio Station:'
    options:

See this posts to sort this.

And also packages documentation.

ok thank you for the guidence, so if i understand correctly the following will be in the config

radio_station:
    name: 'Select Radio Station:'
    options:
      - Radio 538
      - Q-Music
      - 3FM
      - 100% NL
      - Veronica
      - Sky Radio
      - Arrow Classic Rock
      - Classic FM
      - BNR Nieuwsradio
      - SLAM! Hardstyle
      - Sleep Radio
      - Ambient Sleeping Pill
      - Radio Art - Sleep
      - Ambi Nature Radio
      - Calm Radio - Sleep
      - Dinamo.FM Sleep

and then the below in the package/radio_streaming.yaml

chromecast_radio:
    name: 'Select Speakers:'
    options:
      - Lounge
      - Kitchen
      - Milla
      - Bedroom
      - Bose
      - Everywhere
    initial: Everywhere
    icon: mdi:speaker-wireless
    
#############################################################

radio538:
    alias: Play Radio on Chromecast Audio
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.googlehome_ensuite
          volume_level: '0.35'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.kitchen_google_mini
           volume_level: '0.20'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.bedroom_google_mini
           volume_level: '0.30'
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.googlehome_ensuite
            {% elif is_state("input_select.chromecast_radio", "Kitchen") %} media_player.kitchen_google_mini
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom_google_mini
            {% elif is_state("input_select.chromecast_radio", "Milla") %} media_player.googlehome7480
            {% elif is_state("input_select.chromecast_radio", "Bose") %} media_player.chromecast_speaker
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.all_speakers_2
            {% endif %}
           media_content_id: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
            {% elif is_state("input_select.radio_station", "Q-Music") %} http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3
            {% elif is_state("input_select.radio_station", "3FM") %} http://icecast.omroep.nl/3fm-bb-mp3
            {% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Sky Radio") %} http://8623.live.streamtheworld.com:80/SKYRADIOAAC_SC
            {% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
            {% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://vip-icecast.538.lw.triple-it.nl/WEB17_MP3
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Ambient Sleeping Pill") %} http://perseus.shoutca.st:8447/h
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %} http://live.radioart.com/fSleep.mp3
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% endif %}
           media_content_type: 'audio/mp4' 
          


customize:
    script.radio538:
    friendly_name: Start Playing
    icon: mdi:play

right i so created folder called packages
i then created file called chromecast_radio.yaml
i then put the following into that file

input_select:
    radio_station:
        name: 'Select Radio Station:'
        options:
            - Radio 538
             - Q-Music
             - 3FM
             - 100% NL
             - Veronica
             - Sky Radio
             - Arrow Classic Rock
             - Classic FM
             - BNR Nieuwsradio
             - SLAM! Hardstyle
             - Sleep Radio
             - Ambient Sleeping Pill
             - Radio Art - Sleep
             - Ambi Nature Radio
             - Calm Radio - Sleep
             - Dinamo.FM Sleep
chromecast_radio:
    name: 'Select Speakers:'
    options:
      - Lounge
      - Kitchen
      - Milla
      - Bedroom
      - Bose
      - Everywhere
    initial: Everywhere
    icon: mdi:speaker-wireless

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


script:
 radio:
    alias: Play Radio on Chromecast Audio
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.googlehome_ensuite
          volume_level: '0.35'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.kitchen_google_mini
           volume_level: '0.20'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.bedroom_google_mini
           volume_level: '0.30'
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.googlehome_ensuite
            {% elif is_state("input_select.chromecast_radio", "Kitchen") %} media_player.kitchen_google_mini
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom_google_mini
            {% elif is_state("input_select.chromecast_radio", "Milla") %} media_player.googlehome7480
            {% elif is_state("input_select.chromecast_radio", "Bose") %} media_player.chromecast_speaker
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.all_speakers_2
            {% endif %}
           media_content_id: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
            {% elif is_state("input_select.radio_station", "Q-Music") %} http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3
            {% elif is_state("input_select.radio_station", "3FM") %} http://icecast.omroep.nl/3fm-bb-mp3
            {% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Sky Radio") %} http://8623.live.streamtheworld.com:80/SKYRADIOAAC_SC
            {% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
            {% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://vip-icecast.538.lw.triple-it.nl/WEB17_MP3
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Ambient Sleeping Pill") %} http://perseus.shoutca.st:8447/h
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %} http://live.radioart.com/fSleep.mp3
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% endif %}
           media_content_type: 'audio/mp4'

i then put the following into configuration.yaml

packages: !include_dir_named packages

but now i get the following error

Component not found: packages

Did you add it under the homeassistant section of your configuration.yaml

     homeassistant:
       packages: !include_dir_named packages

no i added where the other files are added by !filename

#include configs
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
packages: !include_dir_named packages

i moved it homeassistant section on configurations.yaml but made no difference , same problem of component not found

Ok. I try to add this package and i don’t get error on !include. Only error i get is on chromecast_radio under input_select. Indent is wrong. Move chromecast_radio to right.

ok thanks for trying that
i will move indent now but not sure what is causing my error , scratching my hair away :slight_smile:

so i moved indent and now i get a whole lot of errors…

required key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/automation/
Invalid config for [input_select]: expected a dictionary for dictionary value @ data['input_select']['chromecast_radio']. Got None
expected a dictionary for dictionary value @ data['input_select']['icon']. Got 'mdi:speaker-wireless'
expected a dictionary for dictionary value @ data['input_select']['initial']. Got 'Everywhere'
expected a dictionary for dictionary value @ data['input_select']['name']. Got 'Select Speakers:'
expected a dictionary for dictionary value @ data['input_select']['options']. Got ['Lounge', 'Kitchen', 'Milla', 'Bedroom', 'Bose', 'Everywhere']. (See ?, line ?). Please check the docs at https://home-assistant.io/components/input_select/

Show me all your config for this.

input_select:
    radio_station:
        name: 'Select Radio Station:'
        options:
            - Radio 538
             - Q-Music
             - 3FM
             - 100% NL
             - Veronica
             - Sky Radio
             - Arrow Classic Rock
             - Classic FM
             - BNR Nieuwsradio
             - SLAM! Hardstyle
             - Sleep Radio
             - Ambient Sleeping Pill
             - Radio Art - Sleep
             - Ambi Nature Radio
             - Calm Radio - Sleep
             - Dinamo.FM Sleep
    chromecast_radio:
    name: 'Select Speakers:'
    options:
      - Lounge
      - Kitchen
      - Milla
      - Bedroom
      - Bose
      - Everywhere
    initial: Everywhere
    icon: mdi:speaker-wireless

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


script:
 radio:
    alias: Play Radio on Chromecast Audio
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.googlehome_ensuite
          volume_level: '0.35'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.kitchen_google_mini
           volume_level: '0.20'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.bedroom_google_mini
           volume_level: '0.30'
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.chromecast_radio", "Lounge") %} media_player.googlehome_ensuite
            {% elif is_state("input_select.chromecast_radio", "Kitchen") %} media_player.kitchen_google_mini
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bedroom_google_mini
            {% elif is_state("input_select.chromecast_radio", "Milla") %} media_player.googlehome7480
            {% elif is_state("input_select.chromecast_radio", "Bose") %} media_player.chromecast_speaker
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.all_speakers_2
            {% endif %}
           media_content_id: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://vip-icecast.538.lw.triple-it.nl:80/RADIO538_MP3
            {% elif is_state("input_select.radio_station", "Q-Music") %} http://icecast-qmusic.cdp.triple-it.nl/Qmusic_nl_live_96.mp3
            {% elif is_state("input_select.radio_station", "3FM") %} http://icecast.omroep.nl/3fm-bb-mp3
            {% elif is_state("input_select.radio_station", "100% NL") %} http://stream.100p.nl/100pctnl.mp3
            {% elif is_state("input_select.radio_station", "Veronica") %} http://8543.live.streamtheworld.com/VERONICACMP3
            {% elif is_state("input_select.radio_station", "Sky Radio") %} http://8623.live.streamtheworld.com:80/SKYRADIOAAC_SC
            {% elif is_state("input_select.radio_station", "Arrow Classic Rock") %} http://91.221.151.155/listen.mp3
            {% elif is_state("input_select.radio_station", "Classic FM") %} http://19143.live.streamtheworld.com/CLASSICFM_SC
            {% elif is_state("input_select.radio_station", "BNR Nieuwsradio") %} http://icecast-bnr.cdp.triple-it.nl/bnr_mp3_96_03
            {% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://vip-icecast.538.lw.triple-it.nl/WEB17_MP3
            {% elif is_state("input_select.radio_station", "Sleep Radio") %} http://37.59.28.208:8722/stream
            {% elif is_state("input_select.radio_station", "Ambient Sleeping Pill") %} http://perseus.shoutca.st:8447/h
            {% elif is_state("input_select.radio_station", "Radio Art - Sleep") %} http://live.radioart.com/fSleep.mp3
            {% elif is_state("input_select.radio_station", "Ambi Nature Radio") %} http://94.23.252.14:8067/stream
            {% elif is_state("input_select.radio_station", "Calm Radio - Sleep") %} http://streams.calmradio.com/api/39/128/stream
            {% elif is_state("input_select.radio_station", "Dinamo.FM Sleep") %} http://channels.dinamo.fm/sleep-aac
            {% endif %}
           media_content_type: 'audio/mp4'

Indent, indent, indent. :slight_smile:

    chromecast_radio:
      name: 'Select Speakers:'
      options:
        - Lounge
        - Kitchen
        - Milla
        - Bedroom
        - Bose
        - Everywhere
      initial: Everywhere
      icon: mdi:speaker-wireless