Need help Chromecast audio (Media Center?, Plex?, Kodi?)

Ill try to make this explanation quick. I have been loving HASS and finally diving into everything it can do. I am at a point that I am a little stuck.

Iv’e ordered some refurbished 10" tablets for $30 each and I essentially just want to use them as dashboards. Its getting a little old having to tell alexa/echo to do EVERYTHING!!!

This brings me to the Chromecast Audio devices. For me this is the cheapest/easiest way for me to get audio directed throughout my house. So at first I went through the input_select tutorial and made radio stations through TuneIn Radio direct links and this seems to work well but I have to change my yaml filed everytime I want a new station.

So I added the pandora station media player and figured this would solve my issues. It added well but I cant push the pandora audio to the chromecast speakers through HASS. So I continued reading reading reading and came to the conclusion that HASS just cant do this yet. I came across this link Pi Control Hub and I thought that my dreams had come true. Then I realized that this method sent the audio locally and not to the different chromecast devices.

I was thinking of linking pandora and tunein with Plex and just using the web based UI for operation but this UI doesnt seem too touch friendly. Then I thought of using Kodi but then I dont know a way to send the audio to my chromecast devices.

So now im stuck. All I want is to be able to cast to my chromecast audio devices through HASS using Pandora,TuneIn Radio, and (possible Iheart Radio and Google Play) and have them all in one location on my dashboard.

How did you get the TuneIn Radio direct links?

very easy actually. go to the tune in radio station you are looking for and right click and go to view source.

Hot Hip Hop

(in chrome)
view-source:http://tunein.com/radio/Hot-Hip-Hop-s273492/

search for “StreamUrl”

gives you this

//stream.radiotime.com/listen.stream?streamIds=73770218,73770219&rti=dihyG20zPEkBURwuRw8DR1UyWB8QXEskVhNUFlhXJg4TE0AhMAEKDAoNJnsQRlJiCwcVWAdHRG8eSwh8GRhaGAQcWXRqGAVBBUYGVFtWZgE%3D~~~

Copy that to your address bar

This will output the following string

“{ “Streams”: [{“StreamId”:73770218,“Reliability”:78,“Bandwidth”:192,“HasPlaylist”:false,“MediaType”: “MP3”,“Url”: “http://rfcmedia.streamguys1.com/hothiphop.mp3","Type”: “Live”},{“StreamId”:73770219,“Reliability”:99,“Bandwidth”:96,“HasPlaylist”:false,“MediaType”: “AAC”,“Url”: “http://rfcmedia.streamguys1.com/hothiphop.aac","Type”: “Live”}] }”

This is your URL. For certain devices like chromecast you may need to include the container.

http://rfcmedia.streamguys1.com/hothiphop.mp3

http://rfcmedia.streamguys1.com/hothiphop.aac

6 Likes

@benjimatt Thanks!

Doesn’t seem to work for every station unfortunately:

{ "Streams": [{"StreamId":64534145,"Reliability":43,"Bandwidth":128,"HasPlaylist":false,"MediaType": "MP3","Url": "http://91.221.151.155/","Type": "Live"}] }

try this
http://91.221.151.155/listen.mp3
http://91.221.151.155/listen.mp3

2 Likes

It works! Thanks a million, I spend hours on trying to find the direct link for that particular radio station…

Using Google Home?

nope on the echo

solution: maybe using Google Home

I have been working on the same thing for the past few days, and I have come to the same conclusion, it can’t be done at this time. I would love to find a work around other than buying Google Home :slight_smile:

beeing from the same company is well integrated.

Chromecast Audio and GH can be made as a group

Ok I finally have some type of solution

  1. Icecast2
  2. Mopidy
  3. HASS (iframe)

I created a separate VM in ESXI that is running another instance of ubuntu. The only packages installed on this VM are Icecast2, PIP, Mopidy, mopidy-musicbox-webclient, Mopidy-TuneIn

Icecast:
Once you install icecast I had to change the config from “localhost” to 127.0.0.1 for anything to be able to see this server. I left all other settings default because im lazy. Once we have this server instance we make one more by installing mopidy.

Mopidy:
Mopidy is essentially going to do most of the work. This houses my tunein radio, all local media files, (google music and pandora are both possible too) and the search engine is pretty quick in the app.
Uncomment the MPD Section (change hostname to 0.0.0.0)
Uncomment the HTTP Section (change hostname to 0.0.0.0)
Uncomment the AUDIO Section and change OUTPUT to “output = lamemp3enc ! shout2send mount=mopidy.mp3 ip=127.0.0.1 port=8000”
Add Icecast2 password to this section (default is hackme)

This is your MP3 stream that can be used by multiple clients because of icecast.
After this you need to add you web clients and/or plugins (mopidy-musicbox-webclient, Mopidy-TuneIn)

Chromecast:
Basically you just need to set up Mopidy to send a stream to your Icecast server (which allows multiple streams) I did this by creating a template switch that plays the icecast server stream.

      media_content_id: "http://192.168.1.192:8000/mopidy.mp3"
      media_content_type: "audio/mpeg"

Iframe:
Now that you have a webclient for Mopidy we need to add it to Iframe in HASS. Now your iframe will be on the left side of HASS, You can now play from this section. Once you play music from this section you will need to tell it which speakers to go to by activating one of your switches.

This is the best way that I have found to do this so far. It may not be ideal for everyone but it seems to be working relatively well. I am currently working on a custom panel to see if I can get the chromecast stream switches right above the WebApp. Lets hope it works lol.

4 Likes

Hi, so you created a seperate virtual environment on your Raspberry Pi?
And in that venv you installed the Icecast2 and Mopidy? Can please share some extra steps, sinces this is all new to me and would love to learn this as well!

1 Like

Hi, I’m new to HA and I did some reseach to find a good website to explain benjimatt’s solution. I’m sure it will be usefull to some people so enjoy!
https://www.howtoforge.com/linux_webradio_with_icecast2_ices2
https://github.com/skalavala/Multi-Room-Audio-Centralized-Audio-for-Home/blob/master/Install%20Mopidy.md

I’ve used this method before for the chromecast radio and recently 3 of my radio stations have stopped working (presumably the url’s have changed).

This method no longer seems to be working as searching the source for stream url yields no results and none of the url’s within the page seem to result in being able to find the actual url I want.

Any other ideas?

I’m looking for Free Radio Coventry & Warwickshire, Free Radio 80s and Sleep Radio if anyone already has the url’s. All my others are working fine.

[edit] I managed to find the sleep radio one - but the other two continue to elude me…

For anyone else looking for Sleep Radio:

http://37.59.28.208:8453/stream

@anon43302295 Try this and let me know if it works thx

Free Radio Coventry & Warwickshire
http://tx.whatson.com/http_live_bauer.php?i=freecoventry.aac
redirects to ----(02 varies with different number "02, 03, 08, etc…)
http://icy-e-bl-02-gos.sharp-stream.com/freecoventry.aac

Free Radio 80s
http://tx.whatson.com/http_live_bauer.php?i=free80s.aac
redirects to ----(02 varies with different number "02, 03, 08, etc…)
http://icy-e-bl-04-cr.sharp-stream.com/free80s.aac

Ah, I forgot I cross-posted this and got an answer in the other thread…

Thanks though :slight_smile:

Will this play the music in sync on multiple speakers if you start the streams at the same time with an automation?

If you have the speakers in a group on the Google app you could do this

Hi

Im jjust trying to configure this, ice cast is running, ive made the config changes, however when i run mopidy i get the following error (only when i put password in though)
WARNING Found fatal audio configuration errors:
WARNING audio/username unknown config key. (tried with and without username option)
WARNING audio/password unknown config key.

Config
[audio]
mixer = software
mixer_volume =
output = lamemp3enc ! shout2send mount=mopidy.mp3 ip=192.168.5.232 port=8000
username = relay
password = whatiset during icecast install (checked in config file)
#buffer_time =

Also if i dont set password, mopidy starts but when i try and play a file or stream i get the following error

ERROR GStreamer error: gst-resource-error-quark: Could not connect to server (6)

Any thoughts would be appreciated?

Cheers