Thanks for this. My version I’ve been using for months was just a dedicated script for each station!
Was nice to do something that actually worked to finish off the day - the 12 hours of trying to install Debian, Debian Server, Ubuntu, Ubuntu Server and get HomeAssistant running on something heftier than my Pi 3 was a failure.
If like me you have your audio devices plugged into an AVR or such there is an excellent piece of Automation you might like to add to run alongside this courtesy of @ih8gates - I don’t know where the original is but here is my automation for a ChromeCast Audio that auto switches ON or OFF the AVR and selects source. My CCA is media_player.khonsu and the AVR is media_player.kitchen_avr - the source input for CCA is an optical port AUDIO1
[details=Automation:]…
# kitchen_AVR_khonsu_off:
- alias: Khonsu stops playing
trigger:
- platform: state
entity_id: media_player.khonsu
to: 'off'
action:
service: homeassistant.turn_off
entity_id: media_player.kitchen_avr
# kitchen_AVR_khonsu_on:
- alias: khonsu begins playing
trigger:
- platform: state
entity_id: media_player.khonsu
to: 'playing'
from: 'idle'
- platform: state
entity_id: media_player.khonsu
to: 'playing'
from: 'off'
action:
- service: media_player.turn_on
entity_id: media_player.kitchen_avr
- service: media_player.select_source
data:
entity_id: media_player.kitchen_avr
source: AUDIO1[/details]
Note: I retreived this link by simply opening the m3u file with notepad. A m3u file is nothing more than a redirect for music players. Keep that in mind for if you want to add more streams.
Do you have any hints of finding radio streams? All the ones you have in your config example work, but I do not know the first thing about adding my local radio stations. I added a couple of entries that I thought were right after inspecting the page source into the script, and the input_select script put they never stream. Would you have any pointers for me please?
Oh, and forgot to mention that the same config works great for anyone with a mopidy instance as well, not just chromecast.
input_select.yaml
radio_station:
name: 'Select Radio Station:'
options:
- Radio 538
- Q-Music
- 3FM
- 100% NL
- Veronica
- Sky Radio
- Arrow Classic Rock
- Classic FM
- BNR Nieuwsradio
- SLAM! Hardstyle
- Sleep Radio
- Ambient Sleeping Pill
- Radio Art - Sleep
- Ambi Nature Radio
- Calm Radio - Sleep
- Dinamo.FM Sleep
- CKBW Bridgewater
- 89.9 The Wave
home_radio:
name: 'Select Speakers:'
options:
- ManCave
- LivingRoom
- MasterBedroom
- Bathroom
initial: ManCave
icon: mdi:speaker-wireless
Thanks @Bob_NL that worked for a couple of radio stations. Like it was mentioned by @benjimatt for tunein: You need to have the auto load URL’s from TuneIn for the method to work, but it did. I’ll keep seeing if I can find something for the other ones.
Also, just a quick question but how did you do the group setting so you can stream everywhere? Was it a group you set up or are you calling a Universal Media Player?
You have to define your group in the Google Home app for this. After you set it up in the app, it will show as entity in HASS (media_player.home_group in my case).
Thanks, i’m guessing that option isn’t available with my config (Nexus Player, Chromecast Gen 1 and Chromecast Audio). Tried looking through the Google Home app and there is no option there for any of the three devices I have listed.
The multiroom audio functionality unfortunately is only available for Chromecast Audio (at the moment).
In my case, media_player.home_group consists of 3 speakers (Bathroom, Hall, Livingroom) connected to Chromecast Audio. I also have 2 other Chromecasts (1st Gen. + 2nd Gen.) which can’t be paired to my group.
I’ve incorporated it into my system - I have a few local Australian stations and some 80’s throwbacks. It’s great! I have it streaming to 4 chromecasts and a Google Home - and also as a group for whole house vacuuming background music.
I was wondering if I could set the entity_picture to an image that represents the station being piped?
I was thinking that I could just these last three lines:
I’ll find a better image than that - but I got stuck. I got this error:
17-03-18 20:22:55 ERROR (MainThread) [homeassistant.core] Invalid service data for media_player.play_media: extra keys not allowed @ data['entity_picture']. Got 'http://assets.cdn.iinet.net.au//assets/freezone/radio/radio-triplej-icon.jpg'
After rethinking this it’s a little more complicated than I thought. The script icon is configured in the customize section. I’m not sure if templating is possible there (which is neccessary, right?)