Chromecast Radio with station and player selection

I guess I don’t know much about these services. From reading your response I gather that when I cast from my phone to my chrome cast device, its not the chrome cast device that is “reaching out” to the service, but rather when I hit cast it tells the service to “reach out” to my chrome cast device?

Really nice work Coen. I have imported the text in NodeRed, but what do i really to change in de NodeRed? I have 1 google home mini en chromecast. And also what do i neet to add in de config yaml file?

Hey, guys,
do you have if it works with dot echoes (amazon alexa) I copied the files but it doesn’t seem to work
Thank you for your help

Hello guys, now everyting works very fine by me Only the toggle will not work bij Residentie Radio when turn off or turn on i get this error:

Failed to call service homeassistant/turn_off. Unable to find service input_number/turn_off

afbeelding

On the right side how did you add PLAY and STOP text? By me is dat execute.

Anyone success to get images on HASS?

Not sure it’s what you’re after, but have a look at this:

2 Likes

Anyone a solution about that? the toggle by turn off will not work. Therefore i can’t sent a command from google home to turn off the Radio.

Sorry…Haven’t been on here in awhile. It’s just added in the entities code as an action_name. See below:

          - entities:
              - entity: input_select.chromecast_radio_station
              - entity: input_select.chromecast_radio_speakers
              - entity: input_number.volume_radio
              - action_name: Play
                entity: script.play_chromecast_radio
              - action_name: Stop
                entity: script.stop_chromecast_radio
1 Like

Wow, I missed that option. Great! Thanks for sharing.

Is someone able to help troubleshoot please?
I’m using this script

  alias: Play Radio on Chromecast Audio
  sequence:
      -  service: media_player.play_media
         data_template:
           entity_id: >
            {% if is_state("input_select.select_radio_station", "Kitchen") %} media_player.kitchen_display
            {% elif is_state("input_select.select_radio_station", "Living Room") %} media_player.kitchen_speaker
            {% endif %}
           media_content_id: >
            {% if is_state("input_select.select_radio_station", "BBC Radio 1") %} http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
            {% endif %}
           media_content_type: 'audio/mp4'

Along with input select


but when I execute the script, nothing happens on my Kitchen home hub. There are no errors when I reload scripts so not sure why it doesnt work?

Hello! Thank you!! It works very good! I have an automation that plays the radio script in the livingroom when i dubble press my wall switch there.

My google home in the livingroom and my favorite radiostation are 1st in the elif states in the script, So when i activate the script it plays in de livingroom. That works perfect! But is it possible to copy/duplicate the script so i can set my other rooms at the first elif state?

Radio_livingroom= google home livingroom as first if state (this works now)
Radio_Bedroom= google home bedroom as first if state
Radio_Office = google home office as first if state
Thanks in advance!

You mean you have different wall switches and want to fire off speakers, depending on the wall switch you use. Correct?

Yess, thats what i want!

Just use multiple entity_id’s in the trigger in that case and use the if/elif trigger.entity_id state in a template for the action part.
Something like this:

  trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: 
        - binary_sensor.switch_1
        - binary_sensor.switch_2
        - binary_sensor.switch_3
        - binary_sensor.switch_4
      click_type: double
  action:
    service: media_player.play_media
    data_template:
      entity_id: >
        {% if trigger.entity_id == "binary_sensor.switch_1" %} media_player.speaker_1
        {% elif trigger.entity_id == "binary_sensor.switch_2" %} media_player.speaker _2     
        {% elif trigger.entity_id == "binary_sensor.switch_3" %} media_player.speaker _3        
        {% elif trigger.entity_id == "binary_sensor.switch_4" %} media_player.speaker _4      
        {% endif %}
        ...
        ...
        ...

Genius!! Thank you! I will try it out tonight! I will let you know if it works!

1 Like

When i add/replace the code in automations.yaml i get an indent error: I get the same indention error when i delete the click_type part. I already had checked on indentions, but i cannot see it.

error

- id: '1589750062524'
  alias: Muziek aan
  trigger:
    platform: event
    event_type: xiaomi_aqara.click
    event_data:
      entity_id: 
        - binary_sensor.switch_4687ae5133144076a29a3a0f2911c285
        - binary_sensor.switch_18e5c85f5fa6430c92bbfe7b94acd073
        - binary_sensor.switch_7af97763251e46bd961228d42ac148f8
        - binary_sensor.switch_17e3d67a3e9d4b53a585a61c67798812
	    - binary_sensor.switch_037031357afd4aa297242d460279b071
      click_type: double
  action:
    service: script.radio
    data_template:
      entity_id: >
        {% if trigger.entity_id == "binary_sensor.switch_4687ae5133144076a29a3a0f2911c285" %} media_player.woonkamer
        {% elif trigger.entity_id == "binary_sensor.switch_18e5c85f5fa6430c92bbfe7b94acd073" %} media_player.nesthub8067
        {% elif trigger.entity_id == "binary_sensor.switch_7af97763251e46bd961228d42ac148f8" %} media_player.kantoor
        {% elif trigger.entity_id == "binary_sensor.switch_17e3d67a3e9d4b53a585a61c67798812" %} media_player.keuken
        {% elif trigger.entity_id == "binary_sensor.switch_037031357afd4aa297242d460279b071" %} media_player.hele_huis
        {% endif %}
    

Hello Guys,

Questions;

My config working fine via HASS with selecting different speakers and channels. With the created Radio group i can’t turn on radio via voice to my google home. It says there is a problem happened with Radio. The group on hass working fine. And all other switch/bulbs are working fine via voice to Google Home.

Residence Radio:
  name: Radio
  entities:
  - input_select.radio_station
  - input_select.radio_speakers
  - script.radio_start
  - script.stop_playback

Have hit exposed your script to Google assistant ? If so how? Also what voice command do tout issue ?

Here is my configuration;

# Google Home Configuration
google_assistant:
  project_id: My Project ID by Google
  service_account: !include SERVICE_ACCOUNT.json
  report_state: true
  exposed_domains:
   - switch
   - light
   - group

Which script do i need to expose to Google?
I say Hey Google Turn on Radio. I also see the Radio on Google Home app.