music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.35k stars 51 forks source link

MA Constantly Stops Playing, "Fetching track info failed: Error calling SonosPlayer.poll_track_info on Living Room" error #2996

Open jcmleng opened 2 weeks ago

jcmleng commented 2 weeks ago

What version of Music Assistant has the issue?

2.2.6

What version of the Home Assistant Integration have you got installed?

2024.9.3

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

The problem

MA constantly stops playing. Sometimes midway into a song, Sometimes after a few songs. It is accompanied by this same error in the logs:

2024-10-02 22:22:27.943 WARNING (MainThread) [music_assistant.sonos] Fetching track info failed: Error calling SonosPlayer.poll_track_info on Living Room: HTTPConnectionPool(host='192.168.1.10', port=1400): Read timed out. (read timeout=9.5) 2024-10-02 22:26:27.465 WARNING (MainThread) [music_assistant.sonos] Fetching track info failed: Error calling SonosPlayer.poll_track_info on Living Room: HTTPConnectionPool(host='192.168.1.10', port=1400): Read timed out. (read timeout=9.5)

How to reproduce

Tried different Spotify playlists and different Sonos devices - Arc and Sonos One. Get the same interrupted playing outcome.

Music Providers

Spotify, but only if played through MA

Do not have this issue if I stream directly from Spotify to the same devices, as in the stream plays continuously for hours with no stopping, no buffering.

Radio Station from Radio Browser - no issues of play stopping at all. Have been playing a radio station since the logs were loaded for 21 minutes now, completely uninterrupted with no buffering at all

Player Providers

Sonos Arc and Sonos One. Both devices are ungrouped.

Full log output

music-assistant.log

Additional information

Have no issues with interruption or buffering when streaming video on Google TV devices are located together with the Sonos devices. Internet connection is a stable ~50Mbps.

Hardware setup is straightforward - MA runs on the same RPi 4b, 4Mb as HA. No VPN or other complex network settings.

Have gone through reported issues on music playing stopping but the error messages in those reports are different from the errors I am getting

What version of Home Assistant Core are your running

2024.9.3

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

335iguy commented 2 weeks ago

Are you running the Sonos player provider? I've been using the Home Assistant MediaPlayers provider with the Sonos integration in HAOS and don't have this issue.

What http profile are you using for sending audio? Profile 2 is default. Maybe changing that could fix it?

jcmleng commented 2 weeks ago

Are you running the Sonos player provider? I've been using the Home Assistant MediaPlayers provider with the Sonos integration in HAOS and don't have this issue.

Yes, have been running the MA Sonos player provider. I have both Sonos' set up in HA as media players via the Sonos Integration originally. Will add this to MA and give it a go. Does this mean that under Player Providers, you only have Home Assistant MediaPlayers? Meaning, no Sonos Player Provider at all?

What http profile are you using for sending audio? Profile 2 is default. Maybe changing that could fix it? Have looked at all the Core settings and cannot find this - can you please help advise where I can find this setting to check

Many thanks for the help!

335iguy commented 2 weeks ago

I don't have either Sonos provider in my setup, only HomeAssistant MediaPlayers. All of my Sonos devices are S1, so YMMV. However, after some trial and error it has worked great....except when I make my own issues. :D

EDIT: Saw you mentioned the core settings and can't find this. It's in the Player settings > Advanced Settings

jcmleng commented 2 weeks ago

In a much better spot now, having done the following based on input above from @335iguy :

  1. Deleted the Sonos Player Provider in MA
  2. Added the Home Assistant MediaPlayers (had to load the HA plugin first)
  3. In HA, I have Google TV, Google Nests, Sonos Arc and Sonos One. I only selected Sonos Arc and Sonos One media players

I could only play 1 song at a time from a Spotify playlist at this point.

  1. Under Settings -> Player Settings -> Sonos Arc -> Configure - had to enable Queue Flow Mode (default is Off). Did the same for the Sonos One.

Have now gotten through 8 songs in the playlist on the Sonos Arc for about 25 mins Very stable, no stoppage and the songs transitioned automatically - this setup looks to be the right one. Many thanks again!

335iguy commented 2 weeks ago

Oh yeah. Queue Flow Mode is very important for Sonos devices. I had such a difficult time figuring that one out! It was bliss when I figured that was the case.

Happy to help on this. Enjoy your unstoppable music streams!

OzGav commented 2 weeks ago

You actually should be using the native MA players when they are available. If there are bugs in them they need to be fixed.

jcmleng commented 2 weeks ago

@OzGav , have re-opened the issue based on your comment. Please let me know how I can help in testing etc. to either confirm or resolve this issue.

jcmleng commented 2 weeks ago

@335iguy , having moved over to Home Assistant MediaPlayers, I am still experiencing MA suddenly stop playing a Playlist on its own. The Playlist plays significantly longer on HA MediaPlayers then the MA Sonos Players ie. a playlist can run for maybe 1-2 hours without stopping. But It does stop on its own still. This is on a Sonos Arc.

From the logs, I don't get any error messages but:

2024-10-05 19:08:52.503 INFO (MainThread) [music_assistant.streams] Start Queue Flow stream for Queue Living Sonos Arc - crossfade: False 2024-10-05 19:09:09.381 INFO (MainThread) [music_assistant.streams] Start Queue Flow stream for Queue Living Sonos Arc - crossfade: False 2024-10-05 20:30:57.591 INFO (MainThread) [music_assistant.streams] Start Queue Flow stream for Queue Living Sonos Arc - crossfade: False 2024-10-05 21:31:18.753 INFO (MainThread) [music_assistant.music] Sync task for Music Assistant completed 2024-10-05 21:31:20.443 INFO (MainThread) [music_assistant.music] Sync task for RadioBrowser completed 2024-10-05 21:31:30.613 INFO (MainThread) [music_assistant.music] Sync task for Spotify: Jimmy completed 2024-10-05 21:31:30.614 INFO (MainThread) [music_assistant.metadata] Starting metadata scanner 2024-10-05 21:31:30.623 INFO (MainThread) [music_assistant.metadata] Metadata scanner finished. 2024-10-05 21:52:00.385 INFO (MainThread) [music_assistant.streams] Start Queue Flow stream for Queue Living Sonos Arc - crossfade: False

I actually suspect that the Sonos Integration in HA is not the most stable. I have also had trouble getting MA to play a Playlist once it has stopped - the Start Queue Flow INFO entry is written to the log, but the Sonos would refuse to play.

Will keep monitoring and feedback once I get a clearer pattern of what is happening.

OzGav commented 5 days ago

OK it is likely the issue here is that you are still running the stable server whereas significant improvements have been made in beta. Specifically there are now two providers, one for Series 1 speakers and one for Series 2. You will either need to wait for a future stable release or try and the beta and let us know if that resolves things. You can run both stable and beta on the same host just not at the same time.

jcmleng commented 5 days ago

@OzGav . thanks for the update, that is great news. Will wait for the future stable release and feedback then. Many thanks again for the awesome work on MA!

KillahB33 commented 3 days ago

I have this issue as well, do we have a timeline for beta promotion? Trying to figure out if I should switch or not.

OzGav commented 3 days ago

Days to weeks not months