Music Assistant Results from Service Calls

So im using the Music Assistant integration to provide a visual jukebox. Currently its manual and i setup some custom button cards, call a service to play some playlists on a specific speaker.

I would like to try and make this a bit more dynamic, my thoughts are as follows:

  1. Click a artist picture (this would be a custom card created per artist), this would trigger a call service to locate all albums by artist (information passed would be static from the card config):
action: music_assistant.get_library
data:
  limit: 25
  offset: 0
  album_artists_only: false
  config_entry_id: 01JFM0S4D8054YXQ1VFVP6PB64
  media_type: album
  search: Noisettes

Returned Data:

items:
  - media_type: album
    uri: library://album/304
    name: What's The Time Mr Wolf?
    version: ""
    image: >-
      http://192.168.1.21:8095/imageproxy?path=Noisettes/What%2527s%2520The%2520Time%2520Mr%2520Wolf/AlbumArtSmall.jpg&provider=filesystem_local--dc89msXf&size=0
    artists:
      - media_type: artist
        uri: library://artist/868
        name: Noisettes
        version: ""
        image: null
  - media_type: album
    uri: library://album/305
    name: Wild Young Hearts
    version: ""
    image: >-
      http://192.168.1.21:8095/imageproxy?path=Noisettes/Wild%2520Young%2520Hearts/AlbumArtSmall.jpg&provider=filesystem_local--dc89msXf&size=0
    artists:
      - media_type: artist
        uri: library://artist/868
        name: Noisettes
        version: ""
        image: null
limit: 25
offset: 0
order_by: name
media_type: album
  1. Take the URI, Name and Image from the items attribute on the returned data and create a lovelace card (or cards) showing the albums for the artist (Markdown can be used and formatted but ideally multiple cover arts for each returned album would be ideal)
  2. Upon clicking the album another service call is made to play the selected media URI
action: music_assistant.play_media
data:
  media_id: library://album/304
target:
  entity_id: media_player.ma_upstairs_homepod

Can any of this be done without creating a custom lovelace card (i dont know python and need to read the docs)? Im assuming a script can be created but how do you go about adding the returned data from the service call in step 1 to sensor that can then be used to dynamically drive the lovelace front end.

Hello eximo84,

Is there any particular reason you didn’t ask in the thread for Music assistant? The people that are watching that thread are all either interested. users of, or authors of Music Assistant. They are likely your best resource.

There is also a discord server for it. Not certain if this invite link still works, but here it is.

Whilst my question relates directly to MA it’s also generic enough that others might have an answer.

Dynamically generating cards based on entity attributes.

I see that.
Maybe in another week or 2 someone might see it.
I was just trying to help. :wink: