Home Assistant Radio Streaming
Historically I would listen to the radio by saying “Ok Google - Stream RTÉ Radio One” and my Nest Home Mini would oblige. Recently though, TuneIn has refused stating that RTÉ One is not available in the region I am in (The UK). I initially found Simple Radio which has Chromecast support but when using it was forced to start the stream from my phone rather than by voice as TuneIn is the only radio app supported natively.
I started to search for ways to use Home Assistant to try and come up with a work around. I narrowed it down to three promising posts on the Home Assistant community forum:
- Lovelace chromecast radio jukebox
- Chromecast radio with station and player selection
- Streaming radio on hassio
I started on trying to implement the first link. Quickly I ran in to what I have found to be common difficulties when trying to work with Home Assistant:
- Instructions written by a long time fan of Home Assistant, missing some non obvious pieces for a beginner like myself.
- Instructions and code out of date, Home Assistant has evolved fast and there have been changes in the UI, config, and codebase. Making it difficult to get things up and running without modifications.
- Debugging in Home Assistant is difficult. I have been getting a lot better at this but do find it’s not obvious often how to proceed.
I moved on to the third link and with some lessons learnt from the first failure was able to get it working for me.
The steps then were to:
- Create a
packages
folder inside theconfig
folder. -
Add an include instruction in the
homeassistant
section ofconfiguration.yaml
homeassistant: customize: !include customize.yaml packages: !include_dir_named packages #<-- This line
- Paste in the code from the link to
packages/chromecast_radio.yaml
- I used Configuration Validation which is found in
Configuration -> Server Controls
in the UI. This flagged that I needed to delete a line with a deprecated setting from the code:hide_entity: True
. -
I then added a card to my dashboard with the new entities. These were available after reloading my configuration again from the
Server Controls
tab. The card yaml is below:type: entities title: Radio entities: - entity: input_select.radio_station - entity: input_select.chromecast_radio - entity: script.radio - entity: input_number.volume_radio
- I edited
chromecast_radio.yaml
to have the correct names of my Chromecast devices. I tested on of the existing stations to prove all was working correctly. -
I searched radio-browser.info to find links for the radio stations I wanted and edited the file to include include them:
- I removed the
Listen Radio
automation as I wanted to click theEXECUTE
button after I chose station & speakers rather than it triggering after I edited station alone.
My full chromecast_radio.yaml is available. Originally I had embedded it in a code block in this post but github pages build failed with an unknown Liquid tag error.
Now I can control radio from the UI in Home Assistant but this still requires a device with a web browser to operate. I will cover how I automated starting a stream with a single button press in my next post.