Music Assistant Resume Playing Queue

I’ve recently installed Music Assistant and have just made my first script to automate it. If I wanted to play a certain playlist automatically, that’s already there, but I just wanted it to resume what was playing from the last time I stopped. I work from home, so I have music playing throughout my work day in my office. I created a script to hopefully resume what was playing, but the only way I found to resume was by transferring the queue to the same player and using the auto_play. Is this the only way to resume what was playing?

action: music_assistant.transfer_queue
metadata: {}
target:
  entity_id: media_player.den
data:
  source_player: media_player.den
  auto_play: true

if the queue was not previously cleared, just doing a play action should resume (via press play button or automation), works for me

I tried the play action but it throws the error below. Which way are you able to get this to resume playing?

Failed to perform the action script/play_music_in_den. required key not provided @ data[‘queue_item_id’]

I’ve tried both the “Play Media”

action: music_assistant.play_media
metadata: {}
target:
  entity_id: media_player.den
data: {}

and the “Play Queue Item”

action: mass_queue.play_queue_item
metadata: {}
data:
  entity: media_player.den

I am using action @

action: media_player.media_play
metadata: {}
data: {}
target:
  device_id: d4d27323cd652e62db3257630ef4f40b

I also have a more complex one that plays a specific playlist;

action: media_player.play_media
metadata: {}
target:
  device_id: 78e5ebd5c8571dcd348ca1bd2bc62110
data:
  media:
    media_content_id: library://playlist/10
    media_content_type: playlist
    metadata:
      title: 9hours
      thumbnail: null
      media_class: playlist
      children_media_class: track
      navigateIds:
        - {}
        - media_content_type: music_assistant
          media_content_id: playlists
        - media_content_type: music
          media_content_id: library://playlist/10
      browse_entity_id: media_player.bedroom_chromecast
  enqueue: replace

Thank you for providing the action that is working for you. I noticed there is a media_player.play_media that gives me a similar error too, but only the media_player.media_play you sent so far works for me.

the actions are a bit confusingly named;

play_media I believe is for specifying a playlist/artist/track/etc (ie queue management)

media_play looks to be the player control (player_play would be a better action name IMO)

I used the ui to build these, so the actual yaml I never even noticed before.

I used the UI too, and when I grabbed a “play media” that threw the error, I looked at the yaml and noticed I picked one different than what you sent.