I am from the UK and trying to trigger BBC Radio stations playing on a Chromecast Audio from Home Assistant.
BBC Sounds has integration with Chromecast so that when I say to my Google Home “play BBC Radio 1 on Kitchen” it plays it without any extra configuration from me. When I do that I get the following state attributes against the device that I hoped would allow me to recreate the same action in a script:
volume_level: 1
is_volume_muted: false
media_content_id: bbc_radio_one
media_content_type: music
media_position: 1.125607
media_position_updated_at: '2021-05-05T14:57:47.208614+00:00'
media_title: BBC Radio 1
app_id: 03977A48
app_name: BBC Sounds
entity_picture_local: >-
/api/media_player_proxy/media_player.shower?token=06964956ff9fcfb81360950d777e49fb9d8adcc5ce1fded850e20ea903511a1f&cache=b6acebd86ef09253
friendly_name: Shower
entity_picture: 'https://sounds.files.bbci.co.uk/2.3.0/networks/bbc_radio_one/colour_450.png'
supported_features: 152461
The documentation seems to suggest this should be possible following the format of script in the YouTube or Supla examples. I have tried the following but it doesn’t work:
I didn’t think an error was being generated, but it looks like it is:
Logger: homeassistant.components.cast.media_player
Source: components/cast/media_player.py:515
Integration: Google Cast (documentation, issues)
First occurred: 9:08:59 (2 occurrences)
Last logged: 9:10:45
App bbc sounds not supported
App BBC Sounds not supported
Not sure if this means it just won’t work, I am doing something wrong, or whether a code change is possible?
Between having a 5 week old and never having used python before this is taking longer than I expected, but I should have a PR in for Sounds and iPlayer fairly soon.
I have also created new topic asking about these apps in general, as there could be more opportunities, like tunein. BBC is a priority though for me as well. Thank you
Hi - I’m also keen to know how to use this - does someone have a sample script?
I can speak to Google to play a BBC radio station, and it appears in the HA media player - good. But I want to be able to do this via Home Assistant. I can’t get the code shown in Google Cast - Home Assistant to run.
I currently have buttons on my desk which call scripts to play different BBC Radio stations - but the streams I’m using are going to be switched off in 2023 (e.g. http://stream.live.vc.bbcmedia.co.uk/bbc_6music).
Created a new script, 3 dots, edit as YAML and pasted it in. Worked.
If that works then you can change the “media_id” to “bbc_6music”, which worked for me too. Metadata image I think I got from casting the station by voice and then taking the URL from the properties of the entity playing it.
alias: TEST Cast BBC Sounds to My Chromecast
sequence:
- service: media_player.play_media
data:
media_content_type: cast
media_content_id: >-
{ "app_name": "bbcsounds", "media_id": "bbc_radio_one", "is_live": true
}
extra:
metadata:
metadataType: 0
title: Radio 1
images:
- url: >-
https://sounds.files.bbci.co.uk/2.3.0/networks/bbc_radio_one/background_1280x720.png
target:
entity_id: media_player.mass_all_speakers_3
mode: single
Some subtle differences when I did a comparison of mine to yours, I won’t pretend to know what they mean but I adapted the above from my working version.
Belated thanks for this. It does work, and I’ve tweaked for Radio 4 (see below if you wish). ‘media_id’ can be found by right-clicking on the player when playing in a browser.
alias: TEST Cast BBC Sounds to My Chromecast
sequence:
- service: media_player.play_media
data:
media_content_type: cast
media_content_id: >-
{ "app_name": "bbcsounds", "media_id": "bbc_radio_fourfm", "is_live":
true
}
extra:
metadata:
metadataType: 0
title: Radio 4
images:
- url: "https://ichef.bbci.co.uk/images/ic/1920x1080/p0cbjc9r.jpg"
target:
entity_id: media_player.all_speakers_3
mode: single
My scripts to play 6 Music, Radio 4 and Radio 1 stopped working recently. World Service is working ok, which is confusing, and I don’t see any particular differences between the sequences other than the media_id.
BBC World Service (working):
service: media_player.play_media
target:
entity_id: media_player.kitchen_chromecast_audio
data:
media_content_id: |-
{ "app_name": "bbcsounds",
"media_id": "bbc_world_service",
"is_live": true }
media_content_type: cast
extra:
metadata:
metadata_type: 0
title: BBC World Service
images:
- url: >-
https://sounds.files.bbci.co.uk/3.5.0/networks/bbc_world_service/background_1280x720.png
alias: Play World Service on Kitchen Chromecast Audio
6 Music (not working):
service: media_player.play_media
target:
entity_id: media_player.kitchen_chromecast_audio
data:
media_content_id: |-
{ "app_name": "bbcsounds",
"media_id": "bbc_6music",
"is_live": true }
media_content_type: cast
extra:
metadata: null
metadata_type: 0
title: BBC 6 Music
images:
- url: >-
https://sounds.files.bbci.co.uk/3.5.0/networks/bbc_6music/background_1280x720.png
alias: Play 6 Music on Kitchen Chromecast Audio
When I trigger the script it changes the Chromecast status to paused, and if I then press play it starts playing the World Service. For BBC 6 Music, the status changes to idle, and it won’t play.
Yes, I’m having the same issue with BBC 6music, Radio 1, BBC Radio 2, Radio 4Extra. All seem to follow the same rules as you. The script will begin the cast, the logo / image will appear on the GH screen for around 20-30s and the state will turn from off to idle. But nothing plays and then the image and app seems to close about 30-60s after the script was started.
This started happening ~2-3 weeks back / 2023-09-21T23:00:00Z
If I recall correctly this worked a month ago. I’m doing this with a chromecast audio, so I don’t get any feedback apart from the beep if the script powers it on.