Does anyone know how to assign a music assistant playlist to a Wiim preset (if possible)

r5yk5

Valued Contributor
Joined
Apr 23, 2024
Messages
327
API documentation is like Poruguese for me.
I understand some very basic words but I don't actually speak it.
 
I guess for this to work, WiiM would need to support Music Assistant which unfortunately it doesn't. However, if that playlist can be run from a url then you could add that to Open Network Stream and store that as a preset. That approach can be used to run a playlist in Lyrion for example.
 
However, if that playlist can be run from a url then you could add that to Open Network Stream and store that as a preset. That approach can be used to run a playlist in Lyrion for example.
Thanks

That's what I'm asking about.

I think it is possible, I just don't understand the instructions.
 
I asked Google AI and it came up with this set of instructions and YAML code you'd need to include in your Home Assistant automations.yaml to expose Music Assistant playlists via a url you could add to the WiiM app Open Network Stream and then to a preset. I haven't tested this at all so "caveat emptor" ;)

Guide: Trigger Music Assistant Playlists via WiiM Presets (using Home Assistant)
This setup allows you to trigger specific Music Assistant playlists using a simple URL, which can be saved to WiiM physical preset buttons or the "Open Network Stream" feature.


1. The Home Assistant Automation
Create a new automation, switch to YAML mode, and paste the following. This single automation handles any playlist by passing the name through the URL.

YAML:
alias: "Multi-Playlist WiiM Preset"
description: "Plays any Music Assistant playlist passed via URL parameter"
trigger:
  - platform: webhook
    webhook_id: play_ma_playlist
    allowed_methods:
      - GET
      - POST
    local_only: true
action:
  - action: mass.play_media
    target:
      entity_id: media_player.your_wiim_player_id  # <--- CHANGE THIS to your WiiM entity ID
    data:
      media_id: "{{ trigger.query.name }}"
      media_type: "playlist"
      enqueue: "replace"
mode: single

2. The Trigger URLs
Once the automation is saved, you can trigger your playlists using these URLs. Replace <HA_IP> with your Home Assistant IP address and name= with your actual Music Assistant playlist name.
  • Rock Playlist: http://<HA_IP>:8123/api/webhook/play_ma_playlist?name=Rock
  • Jazz Playlist: http://<HA_IP>:8123/api/webhook/play_ma_playlist?name=Jazz
 
Thanks @Burnside

I don't have Home Assistant running, just Music Assistant. A full HA would be overkill for me.

I'm not using it to play my music library. All I actually would like to do is have MA play the playlists if possible.

I can get a player to stop, or play using the API but can't figure out how to play a specific item.

I use Emby and currently use it's DLNA server to assign playlists to my Wiim presets. This works well, although I have to reassign them each day, as discussed elsewhere on this forum. I don't actually mind that.

The only problem is that Emby's DLNA server doesn't report back what's been playing (update playcounts). I have a "smart" playlist that contains tracks that have hardly ever been played. But it sort of doesn't work because of this limitation.

Today, this was added to MA. It means anything that is played via MA's Emby provider will update the playcount on the Emby server. Which is why I'd like to try and use that rather than DLNA.

Since the playlists update every day if playing them via MA means I don't have to re-add them to my Wiim presets each day, all the better.

And....... if I can use MA's BBC sounds plugin to assign radio 5 live to preset 5, and not get ........ "Due to rights restrictions, this programme is not currently available......", when ever the football/cricket/rugby/tennis etc is on, even better :)
 
I'd maybe post my/google ai's solution on the MA forum (assuming they have such) and see if anyone can say how the HA Yaml to expose a webhook could be implemented in MA sans HA.

Given WiiM already supports BBC radio, can't you simply preset it there?
 
Back
Top