Chromecast Radio with station and player selection

I Also never get past the Activate widget…i never seen a drop down menu to choose speakers or stations…
however, if i click activate, the volume slider appears on TV and thats the best it went…

Hmmm

I’ve been trying for 15 min. to paste my configurations.yaml in blockquoted or preformatted and it just won’t work!!!

Here it is:
indent preformatted text by 4 spaces

pi@raspberrypi:~ $ cat .homeassistant/configuration.yaml
homeassistant:

Name of the location where Home Assistant is running

name: Home

Location required to calculate the time the sun rises and sets

latitude: 31.2156
longitude: 29.9553

Impacts weather/sunrise data (altitude above sea level in meters)

elevation: 0

metric for Metric, imperial for Imperial

unit_system: metric

Pick yours from here: List of tz database time zones - Wikipedia

time_zone: Africa/Cairo

Customization file

customize: !include customize.yaml

Show links to resources in log and frontend

introduction:

Enables the frontend

frontend:

Enables configuration UI

config:

http:

Uncomment this to add a password (recommended!)

api_password: PASSWORD

Uncomment this if you are using SSL/TLS, running in Docker container, etc.

base_url: example.duckdns.org:8123

Checks for available updates

Note: This component will send some information about your system to

the developers to assist with development of Home Assistant.

For more information, please see:

Explaining the Updater - Home Assistant

updater:

Optional, allows Home Assistant developers to focus on popular components.

include_used_components: true

Discover some devices automatically

discovery:

Allows you to issue voice commands from the frontend in enabled browsers

conversation:

Enables support for tracking state changes over time

history:

View all events in a logbook

logbook:

Track the sun

sun:

Weather prediction

sensor:

  • platform: yr

Text to speech

tts:

  • platform: google

group: !include groups.yaml
automation: !include automations.yaml

script: !include scripts.yaml

mqtt:
broker: 192.168.2.228
port: 9001
client_id: mqttc
discovery: true
discovery_prefix: smartthings

light:

  • platform: mqtt
    name: “Far Right Stand”
    brightness_command_topic: “smartthings/Far Right Stand/level/set”
    brightness_state_topic: “smartthings/Far Right Stand/level”
    command_topic: “smartthings/Far Right Stand/switch”
    optimistic: false
    payload_off: “off”
    payload_on: “on”
    qos: 0
    state_topic: “smartthings/Far Right Stand/switch”

  • platform: mqtt
    name: “Right Stand”
    brightness_command_topic: “smartthings/Right Stand/level/set”
    brightness_state_topic: “smartthings/Right Stand/level”
    command_topic: “smartthings/Right Stand/switch”
    optimistic: false
    payload_off: “off”
    payload_on: “on”
    qos: 0
    state_topic: “smartthings/Right Stand/switch”

script:
radio538:
alias: Play Radio on Chromecast Audio
sequence:
- service: media_player.volume_set
data:
entity_id: media_player.chromecast
volume_level: ‘0.30’
- service: media_player.play_media
data:
entity_id: media_player.chromecast
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’

ios:

Thank you so much for posting your code. i was looking for something exactly like this!

For my setup, I have a Monoprice Six Zone controller/amp connected to HomeAssistant. The Monoprice unit has six inputs and six speaker zones. I have one Chromecast connected as an input, and I can output it to all any or all zones. The Monoprice unit doesn’t natively support groups, but I added group support via groups.yaml. It works a treat.

Thanks again!

1 Like

@Bob_NL been using your script for a while now, and I love it.
Quick question, are you aware of a way to display custom picture / album art on the ChromeCast entities?
If I play content from Google Music, I normally get the album art so would like to add some art to my radio stations. Thanks

@lolouk44 glad you like it!

I’m not sure if that’s possible. I was struggling myself with custom icons for every station and I made a feature request topic for this: Templating icons in customize section

Seems like there is not that much interest lol

Just voted for it. If we could have all other users of your script do the same it would help.
Guys?

1 Like

hi @Bob_NL,

trying to customize for my setup, which is only up for a few days…
in which yaml file to put the selectors snippets? Im trying to setup the configuration without editing the configuration file and expand it endlessly, so have the automation.yaml, scripts.yaml etc etc. No where to put the selectors yet though :slight_smile:

Thanks,
Marius

The way they are configured in the startpost, you can put them in your configuration.yaml

That’s exactly what I’m trying not to do …:wink:

Scripts in the scripts.yaml, automations in the automation.yaml etc etc

But where to put the inputs and how to call them. Still new to all of this , so your help is appreciated !

Cheers

Marius

@Mariusthvdb I’m sorry, I misunderstood.
You can basicly name it anything you want as long as u include it in your configuration.yaml.

For example you could use input_selectors.yaml as long as u add this line to your configuration.yaml:

input_select: !include input_selectors.yaml

Take a look at this page for more info: https://home-assistant.io/docs/configuration/splitting_configuration/

Check, that’s what I did but I got so many errors i parked them to ask you first how you’ve set them up exactly.

Please guide me by explaining where you’ve put your pieces of this, and if there’s any special calling procedure besides placing them in the correct files.

Thanks a bunch
Marius

I can’t get Radio 1 (or even 3FM) to work.
Any idea?
I tried:
http://icecast.omroep.nl/3fm-bb-mp3
and
http://icecast.omroep.nl/radio1-bb-mp3

Other urls work fine.

@PuckStar

This 3FM link works fine, I just tested: http://icecast.omroep.nl/3fm-bb-mp3

Does your chromecast play other content?

Ok got it now. First put it in script and made mistake with mp4 because I tried mp3.
Then started testing with the Service call and apparently (found out later in the logs) I put “‘audio/mp4’”.
So too many '.
Removed those and now Radio 1 and 3 work!

But I can’t get Skyradio to work. Do you?

UPDATE: found this url for Sky Radio and it works: http://19993.live.streamtheworld.com:80/SKYRADIO_SC

1 Like

hey friend @Bob_NL, i am trying to find a cheaper solution, for get multiroom áudio. I find this: https://www.youtube.com/watch?v=linWEj72V1Y do you thing that solution Works?

I’m trying to make a solution that either plays speech on one google home or most of them. I can’t seem to get the script to run:

- service: tts.google_say
  entity_id: >
    {%- if states.input_boolean.intercom_whole_house.state == 'on' -%}
      media_player.office_home
    {% else %}
      media_player.living_room
      media_player.xyz
      media_player.office_home
    {%- endif -%}
  data_template:
    message: "{{ speech_message }}"
    cache: true

try…

- service: tts.google_say
  entity_id: >
    {%- if states.input_boolean.intercom_whole_house.state == 'on' -%}
      - media_player.office_home
    {% else %}
      - media_player.living_room
      - media_player.xyz
      - media_player.office_home
    {%- endif -%}
  data_template:
    message: "{{ speech_message }}"
    cache: true

It was an easier solution than I thought. I had to make a group that had appropriate media players. For whatever reason you can’t put in the ‘-’ or you will get an error.

You can also try on a single line with comma’s as seperator, also put the data_template above the entity_id.
So like this:

- service: tts.google_say
  data_template:
    entity_id: >
      {%- if states.input_boolean.intercom_whole_house.state == 'on' -%}
        media_player.office_home
      {% else %}
        media_player.living_room, media_player.xyz, media_player.office_home
      {%- endif -%}
    message: "{{ speech_message }}"
    cache: true