Chromecast Radio with station and player selection

Did you add the automation?

yes

- id: '1537382135003'
  alias: Set Radio Volume
  trigger:
  - entity_id: input_slider.volume_radio
    platform: state
  condition: []
  action:
  - service: media_player.volume_set
    data_template:
      entity_id: >
        {% if is_state("input_select.chromecast_radio", "Livingroom") %} media_player.homemini_livingroom
        {% elif is_state("input_select.chromecast_radio", "office") %} media_player.homemini_office
        {% elif is_state("input_select.chromecast_radio", "Samsung surround speaker") %} media_player.woonkamer
        {% elif is_state("input_select.chromecast_radio", "edifier speaker") %} media_player.edifier_speaker
        {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.thuis
        {% endif %}
      volume_level: '{{  states.input_slider.volume_radio.state  }}'

Change input_slider to input_number

overlooked that one thanks!

1 Like

Hello!

I would like to stream these radio streams: https://www.supla.fi/live
They all seem to use m3u8 playlists. There are two stream url in the stream when inspecting with chrome browser:

master.m3u8 https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/master.m3u8
master-128000 https://digitacdn.akamaized.net/hls/live/629243/radiosuomipop/master-128000.m3u8

Both links works in VLC but they do not seem to be playable in chromecast (Home assistant).

If I paste the first addres to chrome browser, it downloads m3u8 file containing these lines:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-ALLOW-CACHE:NO
## Created with Z/IPStream R/2 v1.03.23
#EXT-X-STREAM-INF:BANDWIDTH=137315,CODECS="mp4a.40.2"
master-128000.m3u8

And the second file:

#EXTM3U
#EXT-X-VERSION:3
## Created with Z/IPStream R/2 v1.03.23
#EXT-X-MEDIA-SEQUENCE:2997421
#EXT-X-TARGETDURATION:6
#EXT-X-PROGRAM-DATE-TIME:2018-10-24T09:10:04Z
#EXTINF:5.99, no desc
01499/seg128000-02997421.aac
#EXTINF:5.99, no desc
01499/seg128000-02997422.aac
#EXTINF:5.99, no desc
01499/seg128000-02997423.aac
#EXTINF:5.99, no desc
01499/seg128000-02997424.aac
#EXTINF:5.99, no desc
01499/seg128000-02997425.aac
#EXTINF:5.99, no desc
01499/seg128000-02997426.aac

I have tried different media types but none seems to work.

I would really like to get the stream work since this is the only stream for this radio channel. I would really appreciate if somebody could take a look of the streams. Thank you in advance!

have you got links to a web player for those streams? ie: the website homepage etc…?

Hello,

Yes, it is www.supla.fi/live

try using this:
https://dynamic-gatling.nelonenmedia.fi/cos/channels/2/orderby=ruutu_list_weight&type=radio

or you might need to trim that down a bit perhaps to:
https://dynamic-gatling.nelonenmedia.fi/

see how it goes. For future when looking for a stream use Chrome and right click the web audio player and select ‘inspect’. A box will show up on the right hand side, hunt through for a stream address. There is post further up this thread that explains it

Hi,

Im not sure if you read my post but I have already inspected the web player and I found 2 m3u8 links as I mentioned.

Links you provided does not work as you may see. Thanks anyway!

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