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.21k stars 44 forks source link

New Bug with YT Music and HA Version 2024.5.5 #2369

Closed Smarthome-Creator closed 1 month ago

Smarthome-Creator commented 1 month ago

What version of Music Assistant has the issue?

2.0.4

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

2024.5.1

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

The problem

After updating to the latest HA version, I get this error message after a few seconds when I try to play a YT Music playlist:

image

This happens on all players that I can control via MA. Radio streams work, for example. So it really seems to be related to YT Music.

How to reproduce

Whenever I want to play a song from my YT playlist.

Music Providers

Youtube Music

Player Providers

All those that I can control via MA. DLNA, SONOS etc...

Full log output

Textdokument (neu).txt

Additional information

No response

What version of Home Assistant Core are your running

2024.5.5

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

OzGav commented 1 month ago

Is it just one particular playlist or all that you have?

Smarthome-Creator commented 1 month ago

@OzGav It affects all YT playlists and even if I only want to play a single song from YT. At first I thought it was just a cache problem, but after several MA and HA restarts, the problem persists. To be on the safe side, I will play playlists from the NAS today.

OzGav commented 1 month ago

Given the title you seem to be suggesting this started with the latest HA update. If so, are you able to rollback and see if the problem goes away?

MarvinSchenkel commented 1 month ago

The log also mentions:

2024-05-26 21:25:16.058 WARNING (MainThread) [music_assistant.providers.ytmusic] Could not resolve a valid URL for item '57VMB1IzLKY'. 
Are you playing music on another device using the same account?

Well, are you? ;-)

Smarthome-Creator commented 1 month ago

@OzGav , I would try this at the weekend.

Smarthome-Creator commented 1 month ago

@MarvinSchenkel, the error keeps coming back. I have already tried the following:

In the hope of clearing all caches.

Playing local or NAS files works without any problems. I cannot test Spotify as I only use a free account. Unfortunately, I don't have any other music providers to test.

MarvinSchenkel commented 1 month ago

Are you 100% sure you are not playing YT music with the same account on another device? E.g. your browser?

I did hit this error on one of my test instances when I upgraded from beta > 2.0. I solved it by completely removing the addon and reinstalling MA, so that would be my next suggestion.

Smarthome-Creator commented 1 month ago

@MarvinSchenkel , I don't have YT Music running on any other device. I have now also tried reinstalling MASS and setting everything up again. Unfortunately, that doesn't work either. Another error message that I am now receiving:

2024-05-28 18:28:01.244 ERROR (MainThread) [music_assistant.webserver] Error handling message: player_queues/play_media: <urlopen error [Errno 104] Connection reset by peer>

MarvinSchenkel commented 1 month ago

@MarvinSchenkel , I don't have YT Music running on any other device. I have now also tried reinstalling MASS and setting everything up again. Unfortunately, that doesn't work either. Another error message that I am now receiving:

2024-05-28 18:28:01.244 ERROR (MainThread) [music_assistant.webserver] Error handling message: player_queues/play_media: <urlopen error [Errno 104] Connection reset by peer>

Any more errors in the log related to this? Don't really have anything to go on here.

Smarthome-Creator commented 1 month ago

@MarvinSchenkel & @OzGav, I have now tried the downgrade to HA 2024.5.4, same problem. Then I went back to HA 2024.5.5 and tried again with MASS Beta but unfortunately the problem persists. I only get this error and only when I try to play a song from one of the YT playlists.

2024-05-28 20:38:22.338 ERROR (MainThread) [music_assistant.webserver] Error handling message: player_queues/play_media: <urlopen error [Errno 104] Connection reset by peer>

Unfortunately, I don't get any more than this error. From what you can find on the internet about the error, it seems to be a Python problem in connection with YouTube-dl, but unfortunately I'm completely out of my depth because I have no idea about programming and I don't fiddle around with the HA.

MarvinSchenkel commented 1 month ago

Did you enable debug logging via the advanced settings menu within the YouTube music provider? Please do so, try again and include a full log so I can figure out what's wrong 💪

Smarthome-Creator commented 1 month ago

@MarvinSchenkel , I have switched it to debug, but in the LOG I still only see the error message. MASS LOG.txt

I only did two things and it hasn't worked since then. I added Snapcast and updated to HA 2024.5.5.

I would like to give you more information, but unfortunately that's all I have. I have a feeling I'm being rejected by YouTube (my domain or something) but I don't know why. When I listen to YT Music on the computer via the browser, there are no problems.

MarvinSchenkel commented 1 month ago

@MarvinSchenkel , I have switched it to debug, but in the LOG I still only see the error message. MASS LOG.txt

I only did two things and it hasn't worked since then. I added Snapcast and updated to HA 2024.5.5.

I would like to give you more information, but unfortunately that's all I have. I have a feeling I'm being rejected by YouTube (my domain or something) but I don't know why. When I listen to YT Music on the computer via the browser, there are no problems.

This new error does not seem related to YTM, could you try playing it on a different speaker by any chance? I feel this error might have something to do with the speaker you are targeting.

Smarthome-Creator commented 1 month ago

@MarvinSchenkel, So I have now tried more:

  1. back to MASS Stable

  2. dismantling Snapcast (I had the assumption that it could be related to this when you said whether I had YTM running on any other player and it seemed that something always got stuck in the pipeline with the snap clients although there should actually be no more streaming).

  3. restarted Add On, problem still there. I'll wait for the next sync from MASS to YTM and see what happens then.

I have tried the various players and protocols. SONOS, Airplay, DLNA, HA Plugin, MASS Companion App, MPD With all of them I only get the “Connection reset by peer” error as soon as I want to play a YTM song.

What I was able to find out, however, is that something gets stuck in a cache.

For example, as soon as I restart my HiFi Berry or other clients, the previously selected songs are suddenly displayed in the player. Once again for understanding:

  1. YTM song selected, error message.
  2. restart the client, the previously selected song is now displayed in the player but not played.
  3. if you press play or want to play another YTM song, error message.
  4. restart the client, everything starts again from the beginning.

Here is another LOG, which has now also collected some DEBUG information. log.zip

Smarthome-Creator commented 1 month ago

@MarvinSchenkel & @OzGav , I have a question because I have just read through the documentation again. When did YTM Free Accounts stop working? It must be only recently, because it was clearly still working until 4 days ago, as I was using it all the time.

This would of course explain the error message “Connection reset at peer”. Then of course it's not a bug, can you confirm that?

MarvinSchenkel commented 1 month ago

@MarvinSchenkel & @OzGav , I have a question because I have just read through the documentation again. When did YTM Free Accounts stop working? It must be only recently, because it was clearly still working until 4 days ago, as I was using it all the time.

This would of course explain the error message “Connection reset at peer”. Then of course it's not a bug, can you confirm that?

We have never supported free accounts. You might have gotten lucky when playing some freely available YouTube videos (via YouTube music), but we do not (and will not ever) support playing back paid content for free using any provider in Music Assistant.

The only way to use free accounts with any provider is via the original platform (eg youtube music or Spotify) because they can compensate by playing you ads

Smarthome-Creator commented 1 month ago

Ok... that could of course explain a lot and I also have a hunch why it worked for me and no longer does.

So no bug, I'm closing the ticket. Thanks for the support.