Chromecast Radio with station and player selection

@luisi.steve are you sure you are using the right entity names for your cast device? As it wouldn’t be very logical to create a group (Home Group) for 1 single device.

OHhhhhhh my Gosh… your right… it never saved my changes to the scripts file…
I never did create the group “home_group” at all was just going to use this with one cast device…

I still had this

service: media_player.volume_set
data_template:
entity_id: >
{% if is_state(“input_select.chromecast_radio”, “Livingroom”) %} media_player.living_room
{% elif is_state(“input_select.chromecast_radio”, “Everywhere”) %} media_player.home_group
{% endif %}
volume_level: ‘{{ states.input_slider.volume_radio.state }}’
service: media_player.play_media
data_template:
entity_id: >
{% if is_state(“input_select.chromecast_radio”, “Livingroom”) %} media_player.living_room
{% elif is_state(“input_select.chromecast_radio”, “Everywhere”) %} media_player.home_group
{% endif %}

not this.

radio538:
alias: Play Radio on Chromecast Audio
sequence:
  - service: media_player.volume_set
    data_template:
      entity_id:
        media_player.living_room
      volume_level: '{{  states.input_slider.volume_radio.state  }}' 
  -  service: media_player.play_media
     data_template:
       entity_id:
        media_player.living_room
       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", "Smooth Jazz Tampa") %} http://us3.internet-radio.com:8007/listen.mp3           
        {% elif is_state("input_select.radio_station", "Classic Rock Florida") %} http://listen.shoutcast.com/Classic-RockFlorida
        {% elif is_state("input_select.radio_station", "Bob Sinclar Radio") %} http://listen.shoutcast.com/prysmradio09-mp3            
        {% elif is_state("input_select.radio_station", "Chill Out Zone") %} http://air.chillout.zone:8000/radio           
        {% elif is_state("input_select.radio_station", "SLAM! Hardstyle") %} http://stream.radiocorp.nl/web11_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'

“input_slider” has been replaced by “input_number”. Check out https://www.home-assistant.io/components/input_number/

Anybody got service: media_player.media_seek to work?

Is this possible with hass.io? Another poster earlier meantioned it not working but maybe things have changed?

Is it possible to do something like this:

icon: "{%- if is_state('input_number.radio_volume', '0')-%}mdi:volume-off{%- else -%}mdi:volume-high{%- endif -%}"

That’d be nice :slight_smile:

Sure, use icon_template:

        icon_template: >
          {%- if is_state('input_number.radio_volume', '0')-%} mdi:volume-off
          {% else %} mdi:volume-high
          {% endif %}

Ohh, sorry, I forgot to say I’ve tried using a template, but I can’t figure out the indentation. I’ve tried every variant I could think of…but it always complains. Below is my input_number.yaml.

radio_volume:
 name: Volym
 #icon: mdi:volume-high
 #icon_template: >- "{%- if is_state('input_number.radio_volume', '0')-%}mdi:volume-off{%- else -%}mdi:volume-high{%- endif -%}"
 icon_template: > {%- if is_state('input_number.radio_volume', '0')-%} mdi:volume-off{% else %} mdi:volume-high{% endif %}
 min: 0
 max: 1
 step: 0.05
 mode: slider

Anyone using media_extractor? For some reason my previous code is not working. Earlier it worked flawlessly to extract audio from any YouTube URL and play to Google Home speaker.

Now it starts streaming then stops after few minutes. There were no errors in the log file.

This is awesome! At first I was disappointed because there wasn’t a way to use Pandora playlists. However I’ve been scouring Iheart radio and other streaming sites and I’ve been able to get stream URLs to most of the music I like. I’m not sure if a true Pandora component is possible, but this is a close 2nd.

1 Like

Anybody got service: media_player.media_seek to work?

can someone help me with this radio? it works in slow motion... :( 

    media_content_id: http://radiodeejay-lh.akamaihd.net/i/[email protected]/master.m3u8
    #media_content_type: 'audio/mp4'
    #media_content_type: /local/master.m3u8
    #media_content_type: 'audio/mp4a'
    media_content_type: 'application/x-mpegurl'

source https://www.deejay.it/radio/?ref=DJ-H-H-MN-1-1

I don’t understand, can you be more specific? What code snippet is that?

Sure, it’s a simple script to test the streaming of the radio.
I’ve read almost the whole discussion, and I’ve noticed that to listen to a streaming .m3u8 I have to use media_content_type: ‘application / x-mpegurl’ and it works, but it’s slow-motion … I was wondering if anyone could help me solve because it goes to slow motion.

  script:
    radiotest:
      alias: radio xxx
      sequence:
        - service: media_player.play_media
          data_template:
            entity_id: media_player.studio
            media_content_id: http://radiodeejay-lh.akamaihd.net/i/[email protected]/master.m3u8
            #media_content_type: 'audio/mp4'
            #media_content_type: /local/master.m3u8
            #media_content_type: 'audio/mp4a'
            media_content_type: 'application/x-mpegurl'

First time i’m hearing this, strange behaviour. I assume you allso tried audio/mp4 as content_type (since it’s commented out in your post)?

Yes, I tried “audio / mp4”
I also tried to put the master.m3u8 file in the www folder and using media_content_type: /local/master.m3u8 but the same result. The sound is slowed.
With VLC on PC it’s okay.

Ok, this radio is very hard to get :frowning:
My hardware is raspberry3 model B sd card 32GB Samsung EVO
Thanks anyway.

I see these errors in logs:
Log Details (WARNING)
Wed May 16 2018 11:20:19 GMT+0300 (RTZ 2 (зима))
Unable to find service media_player/play_media

Why it happened? How fix it?

Is there a way to customize your package to use also google home speakers? And if yes, HOW???

It’s working with Google Home allready, I’m using 6 of them myself.

Can you share how you added these in your package?