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

Volume of snapcast based MA players not updating in home assistant #2370

Closed tc245 closed 2 weeks ago

tc245 commented 1 month ago

What version of Music Assistant has the issue?

2.1.0b1

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

I am using an external snapcast server and have noticed that when changing the volume of the MA media player in either the HA or MA UI the attributes in the state object in developer tools doesn't reflect the new volume and the UI across HA and MA doesn't sync either. The actual sound from the speakers changes but not the state. I have various button controllers to control volume, track change etc of each media player that rely on reading the current volume to increase/decrease by a fixed percentage which doesnt work because it just reads the old state.

How to reproduce

Set up the snapcast player provider and play some audio through a media player. Change the volume in MA or HA UI; the sound output itself will change but not the volume reported in the UI of whichever system didnt change the volume. Then check the state object in developer tools to confirm that the new volume was not recorded there either.

Music Providers

Spotify and jellyfin (these are the only two I have on my system)

Player Providers

Snapcast (the only player provider I have)

Full log output

log.txt

Additional information

Some other things I have noticed:

  1. I also have the HA snapcast integration installed to check if the the snapcast API itself was picking up the volume changes. Whe looking at the snapcast group media player entity (rather then the MA entity) it all works as expected (volume changes are synced and the state object reflects the new volume). The snapcast logs all show volume commands being received by the API when changing volume in both MA and HA.
  2. Other state changes are picked up e.g. when selecting the next track,in MA this is reflected in the new state in HA os it seems to be just the volume.

What version of Home Assistant Core are your running

2024.5.4

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Linux

SantiagoSotoC commented 4 weeks ago

This may be the same as the other volume problem. @tc245 Have you tried changing the volume from snapweb or snapdroid ?

tc245 commented 4 weeks ago

This may be the same as the other volume problem. @tc245 Have you tried changing the volume from snapweb or snapdroid ?

Yes, changing the volume in snapdroid does change the volume in both MA and HA.

Are you talking about #2106 as the potentially similar issue?

SantiagoSotoC commented 4 weeks ago

Yes, it looks like the same, all problems use the same part of the vendor code.

The volume is not updated correctly in MA, therefore it is not updated in HA. I changed the code to be the same as in HA seems to have fixed it, but I have to test it some more.

JannikL87 commented 4 weeks ago

Issue here with volume not updating as well. The volume changes, but it's not reflected in the media player card.

OzGav commented 3 weeks ago

Hopefully fixed in the next update. Please advise if not.

OzGav commented 3 weeks ago

@tc245 2.1.0b4 is released please confirm this is fixed

SantiagoSotoC commented 3 weeks ago

@OzGav i have to revert a commit

tc245 commented 3 weeks ago

@OzGav i have to revert a commit

Ok I'll hold off for now!

SantiagoSotoC commented 2 weeks ago

@OzGav i have to revert a commit You can try latest beta that should be solved

tc245 commented 2 weeks ago

Can confirm that beta 4 seems to have fixed my volume issue. Many thanks as always for all your work! I'm happy to close this issue now?