Chromecast Radio with station and player selection

This is very cool. I like the idea of having some buttons, like Dinner Party, Working in the Garage, etc. Then having those trigger some stations and possibly some lighting. Thanks for the examples!

1 Like

Hello @Bob_NL .
Friend, tell me, how many speakers do you have? 5? Can you share which ones? Does the sound go to the columns with only a chromecast? Sorry for my questions but this topic has not yet dominated.

I currently have 4 speakers setup (just a couple of cheap ball speakers I got from Wallmart several years ago). Not the best sound quality but perfect for TTS and radio streaming.

Yes, sound is send straight to Chromecast. The nice thing of Chromecast Audio is that it’s a very affordable multiroom audio solution. “Sonos on a budget” (with a slight setback of options) :wink:

humm, ok so, i only need to buy a wireless speakers and one chromecast? do you have a idea, where i can buy it cheap?

You don’t even need a wireless speaker, any speaker with a 3.5mm “headphone” jack will do (actually you absolutely do need the 3.5 inch jack input). Connection to your Chromecast is wireless, connection from your Chromecast to your speaker is wired (cable comes in the box with the Chromecast).
Off course you will need a seperate Chromecast per speaker (so you’ll need to buy several if you want multiroom audio).

I don’t have these myself but these supposed to be pretty decent for this price: https://www.amazon.com/JBL-Portable-Wireless-Bluetooth-Strap-Hook/dp/B00TFGWAA8

Okay, so you have 5 chromecast in each speakers is that? Or have you cables all over your house?

Thanks for sharing. It worked great. How do I add buttons to stop/pause/play radio streaming?

You can use one Chromecast Audio with one speaker. Choose a speaker with a 3.5 input jack and plug the Chromecast into it, then the Chromecast and the speaker into AC power. No cables needed, it uses Wifi.

I understood, my question was … if I have two wireless speakers … if only with one chromecast I can send the sound to each of them individually.

Example of morning to play music in the bathroom.

At night, play music in the room.

Chromecast connects wirelessly with the router not the speaker, at least mine does, it physically plugs into the speaker/tv.

I just wanted to take a second and say thank you for the volume slider idea. Works killer. Also I’m not using the “Start Playing” button to activate the script, I just decided to throw it all in an automation so when the radio station is picked and the state changes then it automatically starts playing.

1 Like

@sbmlat you can configure a script for the pauze/play button like this:

  pauze_play_radio:
    alias: Pauze or Play Radio
    sequence:
      service: media_player.media_pauze
      data_template:
        entity_id: >
            {% if is_state("input_select.chromecast_radio", "Livingroom") %} media_player.ca_livingroom
            {% elif is_state("input_select.chromecast_radio", "Hall") %} media_player.ca_hall
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bed_room
            {% elif is_state("input_select.chromecast_radio", "Bathroom") %} media_player.ca_bathroom
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.home_group 

Haven’t tried it myself but it probably will resume playing if you press the script button again after pauzing it.

Note: You have to ask yourself if you really want to pauze a radio stream. Why not just stopping it and reloading it again? That way you will keep listening to live radio instead of having a delay. Also, streams will probably not be able to keep the pauzed state for a long time (don’t know the default buffer time).

1 Like

Why not just stopping it and reloading it again? That way you will keep listening to live radio instead of having a delay. Also, streams will probably not be able to keep the pauzed state for a long time (don’t know the default buffer time).

That ‘pause’ script option worked. I agree with you regarding pausing radio stream.

1 Like

Would you mind sharing that snippet?

What’s the difference between ‘script’ and ‘automation’?

The main difference is that an automation looks for a trigger and then will run where a script is usually activated.

Here is my radio code ( note one or two of the stations do not work )

alias: Radio
trigger:
  platform: state
  entity_id: input_select.radio_station
action:
  - service: media_player.play_media
    data_template:
      entity_id: >
        {% if is_state('input_select.radio_station_location', 'Kitchen') %}
          media_player.kitchen
        {% elif is_state('input_select.radio_station_location', 'Backyard') %}
          media_player.backyard
        {% endif %}
      media_content_id: >
        {% if is_state('input_select.radio_station', 'Hot 108') %} http://jbmedia-edge1.cdnstream.com:80/hot108
        {% elif is_state('input_select.radio_station', 'The Beat') %} http://live.leanstream.co/CKBTFM-MP3
        {% elif is_state('input_select.radio_station', 'Alt Rock') %} http://149.56.23.7:20254/stream
        {% elif is_state('input_select.radio_station', 'Energy 98') %} http://174.127.85.10:8800
        {% elif is_state('input_select.radio_station', 'Hit Remixes') %} http://149.56.23.7:20252/stream
        {% elif is_state('input_select.radio_station', 'Rock Radio') %} http://91.121.75.155:8000
        {% elif is_state('input_select.radio_station', 'Play Radio') %} http://176.9.31.78:8222
        {% elif is_state('input_select.radio_station', 'GD UP RADIO') %} http://50.7.70.66:8577
        {% elif is_state('input_select.radio_station', 'Elium-Rock') %} http://listen.radionomy.com/Elium-Rock
        {% endif %}
      media_content_type: 'audio/mp3'
1 Like

Where i need to put the Script:?
Where i need to put the Selectors:?

Thanks!

@mp3llll easiest way is to just add it to your configuration.yaml.

I use different yamls for my scripts, automations etc. but that only works if you link to them in your configuration.yaml:

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
group: !include groups.yaml

Check here for more info:
https://home-assistant.io/docs/configuration/splitting_configuration/

sorry bod, im new in ha…
but were i need to put the script? i need to copy it and make a new file.yaml?

No need to apologize, we all need to learn (rather new to HA myself as well).

Let’s start with the easier part (perhaps you could take a look at the splitting part when you’re more comfortable with HASS and configuring) :wink:

Just put this in your configuration.yaml:

script:
  radio538:
    alias: Play Radio on Chromecast Audio
    sequence:
      - service: media_player.volume_set
        data:
          entity_id: media_player.ca_hall
          volume_level: '0.35'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.ca_bathroom
           volume_level: '0.20'
      -  service: media_player.volume_set
         data:
           entity_id: media_player.ca_livingroom
           volume_level: '0.30'
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.chromecast_radio", "Livingroom") %} media_player.ca_livingroom
            {% elif is_state("input_select.chromecast_radio", "Hall") %} media_player.ca_hall
            {% elif is_state("input_select.chromecast_radio", "Bedroom") %} media_player.bed_room
            {% elif is_state("input_select.chromecast_radio", "Bathroom") %} media_player.ca_bathroom
            {% elif is_state("input_select.chromecast_radio", "Everywhere") %} media_player.home_group
            {% 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'

Note the extra line I added at the start:

script: