core icon indicating copy to clipboard operation
core copied to clipboard

Music Assistant does not support pause any more

Open Links2004 opened this issue 9 months ago • 12 comments

The problem

Since the last update its not longer possible to pause the media player of Music Assistant. the UI shows Entity media_player.eg does not support action media_player.media_play_pause.

Pressing pause in the Music Assistant UI is working.

Image

What version of Home Assistant Core has the issue?

core-2025.3.1

What was the last working version of Home Assistant Core?

core-2025.2.4

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Music Assistant

Link to integration documentation on our website

https://www.home-assistant.io/integrations/music_assistant/

Diagnostics information

2025-03-08 14:08:49.654 ERROR (MainThread) [homeassistant.components.automation.radio_media_player_play] radio media_player: Choose at step 1: choice 1: Error
 executing script. Error for call_service at pos 1: Entity media_player.eg does not support action media_player.media_play_pause                              
2025-03-08 14:08:49.655 ERROR (MainThread) [homeassistant.components.automation.radio_media_player_play] radio media_player: Error executing script. Error for
 choose at pos 1: Entity media_player.eg does not support action media_player.media_play_pause                                                                
2025-03-08 14:08:49.655 ERROR (MainThread) [homeassistant.components.automation.radio_media_player_play] Error while executing automation automation.radio_med
ia_player_play: Entity media_player.eg does not support action media_player.media_play_pause   

home-assistant 2025-03-08 14:17:43.682 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139990019491440] Entity media_player.eg do
es not support action media_player.media_play_pause

Example YAML snippet


Anything in the logs that might be useful for us?

home-assistant 2025-03-08 14:17:43.682 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139990019491440] Entity media_player.eg do
es not support action media_player.media_play_pause

Additional information

This worked fine befor, suspect that this is related to https://github.com/home-assistant/core/commit/f111a2c34a8d4e0be6501334bc11f9d873fef5e5

Music Assistent Server version: 2.4.3

Links2004 avatar Mar 08 '25 13:03 Links2004

Hey there @music-assistant, mind taking a look at this issue as it has been labeled with an integration (music_assistant) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of music_assistant can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign music_assistant Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


music_assistant documentation music_assistant source (message by IssueLinks)

home-assistant[bot] avatar Mar 08 '25 13:03 home-assistant[bot]

What kind of player is this ? Normally this message only shows if the player actually does not support pause. The MA interface just sends stop if a player does not support pause. Also, the default HA media player card will show a stop button instead of pause. So I think you just need to update your player card ?

marcelveldt avatar Mar 09 '25 00:03 marcelveldt

Its a playergroup with only snapcast clients in it. Pause / Play is working fine in the Music Assistant UI the music restarts in the place it where stopped.

the card shown is custom:mini-media-player seams to not support the detection, but not the problem here. the device menu has only a stop button no pause any more.

my automation have also been broken so its not only a UI problem (but UI is the easiest to show in a issue).

Image

Links2004 avatar Mar 09 '25 08:03 Links2004

Like I told you, the MA interface will simply call stop if pause is not supported. You just need to update your card to show stop instead of pause and you're all set.

marcelveldt avatar Mar 09 '25 15:03 marcelveldt

For all clarity: snapcast players do not support pause so this behavior is entirely correct. Nothing is broken.

marcelveldt avatar Mar 09 '25 15:03 marcelveldt

I do not understand why the technical detail on how MA server implements the "pause" in its code has any need to break the media_player.media_play_pause. form a user point of view it makes no difference how the MA server handles "pause".

Why does HA or the end user need to care if MA can use a real "pause"/"play" or a "stop"/"start play at time x" in its code?

The MA UI does not make a difference too, it shows a "pause" button and it works like a "pause" button, I simply do not see why the user experience need to be different.

From a technical point of view it may is correct that the player has no "pause" but the MA Server emulates it in its code any way so way not expose this to HA?

media_player.media_play_pause did work correct in HA before the change, and now its not working any more.

there is no media_player.media_play_stop or similar action in HA to replace it. every one that uses this in automation now need to write a check current state switch case, for something that where working before the change.

Links2004 avatar Mar 09 '25 16:03 Links2004

Again, Snapcast players do not support pause. HA policies requires that you set the supported feature on the media player so it will enable/disable the control dependently.

A bug was fixed which accidentally reported pause feature for all players. This didn't lead to any issues because some internal logic in MA will translate pause to a player that does not support that to stop instead.

So what happens today is that the HA mediaplayer represents the actual truth. If a player supports pause natively, you will get the pause control from HA and if it doesn't, it will hide them and you need to use stop.

We can debate ofc if we should make an exception in case of MA because that is able to translate pause to stop automatically. @joostlek do you have an opinion on that from a HA core perspective ? Would it be allowed to set the pause feature to true for all MA players ?

marcelveldt avatar Mar 14 '25 11:03 marcelveldt

But what does stop mean in a snapcast context? If it's the same as we expect from a pause, then it should be a pause

joostlek avatar Mar 14 '25 14:03 joostlek

But what does stop mean in a snapcast context? If it's the same as we expect from a pause, then it should be a pause

No, stop=stop and pause=pause. Two different things.

Some players support pause, some do not. HA differentiates between pause and stop (maybe something from the past). In MA we've abstracted the difference away and if you send a pause while a player doesn't support it, we'll send stop instead but the big difference is that a paused player can be guaranteed resumed while a stopped player is not.

So you send pause to e.g. a Snapcast player and then it stops, the state will be "idle". You send pause to a Sonos speaker, the state will be "paused" and if you send a dedicated stop, it will be idle.

marcelveldt avatar Mar 15 '25 20:03 marcelveldt

I think we should pick what is more logical to the service then, so clicking pause in HA should do the same as clicking pause in MA. While in the end it might be strange to the user why you can pause it at all, that is something for MA to look at

joostlek avatar Mar 15 '25 20:03 joostlek

We just show one single button, just like any other modern application nowadays. Differentiate between stop and pause is a bit cassette deck era 😀. What it does under the hood is player dependent.

Maybe time for HA to also drop the strict difference?

marcelveldt avatar Mar 15 '25 20:03 marcelveldt

Had a little chat with @joostlek about this and we decided that for pause, instead of following what the player itself natively supports, we follow the default behavior of Music Assistant.

Music Assistant automatically translates pause into stop if a player does not support pause by itself (such as snapcast). So we'll adjust the HA integration and simply always report pause support for all players.

marcelveldt avatar Mar 25 '25 18:03 marcelveldt