Chromecast Audio devices on HAOS - unstable
Chromecast Audio devices on HAOS - unstable
Author
Discussion

2Btoo

Original Poster:

3,670 posts

219 months

Monday 21st July
quotequote all
Guys,

I'm trying to play BBC Radio 4 nice and reliably on some gen1 Chromecast Audio devices, driven by Home Assistant. And am struggling.

I have HAOS running in KVM on an old IBM thin client machine. It's stable and is connected via ethernet to a TPLink switch. The rest of the network comprises a couple more TPLink switches and three Deco M5 mesh access points, as well as a few PC's. Broadband is via fibre and an EERO6 router.

I have five first-gen Chromecast Audio devices on the main WiFi network, plus an 'All Rooms' group set up in Google Home.
HAOS has a script which causes Radio 4 to be played on these devices. The script looks like this in PasteBin:

https://pastebin.com/YQWt0pg6

It's been written with some help from ChatGPT as I am not good at this sort of thing, but I think I understand what is going on with it. The problem is that it doesn't work reliably. It is called by an automation (different automations depending upon the day of the week) and often it simply doesn't work; I can see that the automation has triggered but the radio hasn't come on. Here's a log from one of the CCA's from this morning:

Bedroom Chromecast Audio changed to Playing
07:33:46 - 18 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:33:41 - 18 minutes ago
Bedroom Chromecast Audio changed to Playing
07:33:40 - 18 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:33:40 - 17 minutes ago
Bedroom Chromecast Audio changed to Playing
07:33:02 - 18 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:33:01 - 18 minutes ago
Bedroom Chromecast Audio changed to Playing
07:32:23 - 19 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:32:23 - 19 minutes ago
Bedroom Chromecast Audio changed to Playing
07:31:45 - 19 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:31:45 - 19 minutes ago
Bedroom Chromecast Audio changed to Playing
07:30:34 - 21 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:30:33 - 21 minutes ago
Bedroom Chromecast Audio changed to Playing
07:30:08 - 21 minutes ago
Bedroom Chromecast Audio changed to Buffering
07:30:07 - 21 minutes ago
Bedroom Chromecast Audio changed to Idle
07:30:04 - 21 minutes ago
Bedroom Chromecast Audio turned off
07:30:04 - 21 minutes ago
Bedroom Chromecast Audio changed to Idle
07:29:54 - 21 minutes ago
Bedroom Chromecast Audio turned off
03:11:07 - 5 hours ago
Bedroom Chromecast Audio became unavailable
03:10:45 - 5 hours ago
Bedroom Chromecast Audio turned off
01:05:00 - 7 hours ago
Bedroom Chromecast Audio changed to Idle
01:00:00 - 7 hours ago

You can see where the radio was turned off (by a script) at 1.0am but nothing when it was called by the script above at 6.45am. It did however work well when I triggered the script manually at 7.28am.

What can I do to make this work more reliably?

I am aware that the script calls the bbcsounds app on the 'all_rooms' group. Previously I used the service media_player.play_media to stream directly from a URL to the CCA group. The Pastebin for this is here:

https://pastebin.com/iNYm3Dt1

This previous method was perhaps a bit more reliable in starting the CCA's in the morning but they dropped out several times during the day. The current method s less reliable in starting in the morning but does run more reliably during the day, cutting out less frequently.

The CCA's are all at fixed IP addresses and all get a strong WiFi signal.
The network is a 5GHz one.
I am aware that my network doesn't fully support multicast; it seems that multicast requests can go out but no devices reply.

What are my options to make things better?

Is there improvement yet in the YAML for the PlayRadio4 script (perhaps pinging devices individually to wake them up, then pausing for 30 seconds before running the bbcsounds app on them)?

Or should I swap all my DecoM5 devices for a mesh system that runs multicast (probably an EERO6 system, given that I have an EERO6 router already)?

Or should I start again with something entirely new?

The most reliable option is a simple FM radio in the bedroom which has a timer, both to switch off at 1.0am and to play in the morning. Can I achieve this functionality with the kit I have or do I need to dig my old Sony FM thing out of the basement and find some AA batteries to put into it?

ARHarh

4,843 posts

123 months

Monday 21st July
quotequote all
I run 2 chrome cast audios through haos in a proxmox vm. Never have a stutter from them. I don't play radio 4 though. But do sometimes play BBC Wales or radio 2.

How are you playing the stations? I use music assistant and have the stations set as favourites.

2Btoo

Original Poster:

3,670 posts

219 months

Tuesday 22nd July
quotequote all
ARHarh,

Thanks. Pushing from Music Assistant would mean effectively streaming from a URL, which is the other way of doing things.

This works and starts more reliably for me, but drops out several times during a day and needs a kick to re-start.

Neither option is perfect!

ARHarh

4,843 posts

123 months

Tuesday 22nd July
quotequote all
I use music assistant because it also works with my esp voice stuff and a media player doing it via HA with direct urls does not work with my esp stuff so I assume there is something different going on with the way music assistant handles it. But there is no way I could understand that smile

My guess is there is an issue with you network for the chrome casts, Mine when I first got them were a bit flakey on the 2.4 ghz wifi, and 5ghz was a bit weak being further away, a bit of moving my AP sorted that out.

What bit rate are you trying to run? There are a few.

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

It may help.

2Btoo

Original Poster:

3,670 posts

219 months

Saturday 26th July
quotequote all
ARHarh said:
I use music assistant because it also works with my esp voice stuff and a media player doing it via HA with direct urls does not work with my esp stuff so I assume there is something different going on with the way music assistant handles it. But there is no way I could understand that smile

My guess is there is an issue with you network for the chrome casts, Mine when I first got them were a bit flakey on the 2.4 ghz wifi, and 5ghz was a bit weak being further away, a bit of moving my AP sorted that out.

What bit rate are you trying to run? There are a few.

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

https://lsn.lv/bbcradio.m3u8?station=bbc_radio_fou...

It may help.
Hi ARHarh,

Thanks for this. Streaming direct from a URL is an option and I did as you did (streaming direct using Music Assistant) up until a month or so ago. It was a desire to get away from slightly buggy audio that caused me to move away.

As it is, I have simplified the script I use to run Radio 4 and it seems to have solved the problem. I am sure I used this simple version and it was unreliable, so I tinkered with it and it ended up being a big behemoth which was still unreliable (an aside, but I think that this is a failing of ChatGPT as an assistant for developing code; it always seems to encourage more and more complexity and never tries simplifying, but that could just be my experience.) I went back to a much simpler script to start again and it seems to work reliably, so I'm happy!

FWIW I run the on a 5Ghz network and they seem reliable enough. T'internet tells me that I need a multicast network to make they run totally reliably and my hardware won't do multicast, but given that they now seem OK I'll not splash out on new kit.

Thanks for the link for streaming locations. They could be useful if I change tack again.