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.39k stars 51 forks source link

No sound on AirPlay device (HomePod Mini) #2765

Closed niteguide closed 2 months ago

niteguide commented 3 months ago

What version of Music Assistant has the issue?

2.2.0b6

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

2024.8.0

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

The problem

Usually playback on the HomePod Mini works fine, but sometimes (arbitrarily) the sound-output stops (=no sound) and does not come back although music still appears to be playing within MA. At this point: HomePod Mini added via AppleTV integration changes Entity-status to Idle. HomePod Mini added via MA still has Entity-status Playing.

How to reproduce

Happens arbitrarily during playback.

For example today (Aug 16) no sound at 09:31:41 after playing flawlessly since 07:33:32

Music Providers

Only Spotify in use.

Player Providers

Happens on HomePod Mini. At this point not observed when playing on Chromecast.

Airplay specific settings: Enable encryption: no Enable compression: no

Full log output

music-assistant.log

Additional information

Router Settings (Synology MR2200ac):

PMF Support: Disabled Key rotation: 3600 DTIM: 4 Multicast translation: no AMPDU: yes U-APSD: yes AP isolation: no MU-MIMO: yes 802.11r: no Disable Smart Connect for devices not supporting 802.11v: yes Regional compatibility: no

What version of Home Assistant Core are your running

2024.8.1

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

marcelveldt commented 3 months ago

Try for a while without the HomePod added to HA and also be sure to check the settings in Apple Home that they are set to "allow streaming within the network"

niteguide commented 3 months ago

Under "speaker and TV" within Apple Home App I had "All in the same network" selected. I assume you mean delete the AppleTV integration - will do just that and see ...

niteguide commented 3 months ago

Here is an update on that issue. The problem occurred again today on AirPlay despite AppleTV integration deleted. About half an hour later I also had this exact same error with Chromecast (today the first time). In MA the song appears to be playing; when I manually click on the Forward-Button to skip the current song sound immediately comes back with playing the next song in queue.

marcelveldt commented 3 months ago

Wild guess but maybe your router has some short dhcp lease times and the ip of the device changes often ? This sounds like network(related) issues tbh. I have a couple of homepod minis here playing music all day without a glitch.

Does your Home Assistant server have a static IP set ? DHCP (without reservation) will also cause issues.

Another thing you could check is go to MA settings --> Airplay provider --> advanced section, check if the Bind IP matches with the IP address of your HA host.

niteguide commented 3 months ago

For HA I have a static IP address set within HA. For HomePod Mini and Google Home Mini the static IP address is set on the router - so no DHCP involved at all. Compared HA-IP with Bind interface IP -> same! (but without any port number added) Very strange because I did not have these problems until some recent MA updates. Nothing changed regarding my network setup.

marcelveldt commented 3 months ago

I now notice you mention Spotify playback. We have had some challenges with spotify after they decided to stop supporting username and password logins. We needed to adjust our flow to incorporate a full pkce oauth flow and patch librespot.

After implementing that, we ran into a couple of bugs and edge cases which we've been working out in a series of beta updates last couple of days.

In beta10 it should already work much, much better but I found another small glitch that could explain the issue you describe: The token expiration at the exact same time of a new song loading into the queue; you can imagine that will halt playback.

So keep an eye out for beta11 and let e know if that resolves your issues.

niteguide commented 3 months ago

Beta11 came out and I will test now for a couple of days. I recognized that there now even more is going on in the Logbook of the Chromecast device, hundreds of status changes - here is a screenshot, just to check if this is intended:

Bildschirmfoto 2024-08-20 um 12 55 06
marcelveldt commented 3 months ago

Beta11 came out and I will test now for a couple of days. I recognized that there now even more is going on in the Logbook of the Chromecast device, hundreds of status changes

This issue report is about Airplay, not Chromecast. Maybe a create a new issue report for this issue ? You either have some serious network issues or that chromecast has some issues. In any case its not caused by MA or a MA update.

OzGav commented 3 months ago

@niteguide please close this if the Homepod is working

OzGav commented 2 months ago

This will be closed soon if no further followup

niteguide commented 2 months ago

@OzGav I would not consider that as completed. As I said I wanted to check a few days and for several hours of continuous playback. So far I have not experienced the issue on Home Pod Mini again but it happens on Airport Express - very rarely. After some time all of a sudden sound stops (as described above) and does not come back until I press the forward button and go to the next song. So I can say that all the measures taken had a clear effect and the problem does not come on a regular basis ... but it still happens!

OzGav commented 2 months ago

The AirPort Express is very old. If you have a problem with it then you need to open a new issue with appropriate logs. Please review the closed issues as there are some from others with this device.