AI generated stations/playlists for Music Assistant

I have a collection of automations, scripts and python that is currently working well on my HA/MA setup. I’m considering turning it into a HACS integration if there’s interest.

The way it works is that you define “stations” with a prompt something like this:

“Classic Rock Foundations”: “Generate a playlist of classic rock songs from artists such as The Beatles, The Rolling Stones, The Kinks, Led Zeppelin, The Doors, Jefferson Airplane, Jimi Hendrix, The Byrds, The Animals, Steve Miller Band, The Who, The Zombies, Tom Petty, Van Morrison, Warren Zevon, Grand Funk Railroad, Free, Santana, Cream, Crosby Stills & Nash, The Eagles. Include similar songs and artists that fit the classic rock foundation style.”

It will generate an initial playlist and then call music_assistant.play_media which will match the track against your providers. It monitors the queue and reloads new tracks as it gets low, with deduping for a configurable number of tracks in history. I originally used “don’t stop the music”, but found for more niche stations it tended to drift and have more dups.

I have about 30 different prompts and have been using using this with my own library and Apple Music for several months and tweaking it along the way. It’s pretty solid for me at least, it’s been a fun way to expand my music listening too. If there’s interest I’ll see about making it a HACS integration. If not, I’ll just keep listening…

4 Likes

I’m interested in that, it sounds pretty cool!

I’ve used a last.fm-fuelled playlist generator on kodi in the past, but it too seemed to drift off-course a bit.

I assume you mean for if you’re using assist without an LLM …and you want the richness of an LLM response for different music and mixes etc? (totally see that use case)

(because an agent operating the MA LLM scripts can already do this…)

Hey, I’ll pull things together and put it up on GitHub in the next week or so.

1 Like

AI Playlist

AI-powered playlist generation for Home Assistant + Music Assistant.

Uses any AI Task provider (Anthropic, OpenAI, Google, Ollama, etc.) to generate tracks based on text prompts, enqueue them on Music Assistant speakers, and automatically refill as you listen.

AI Assisted

Full disclosure, although this was originally a set of scripts, automations and pyscript I wrote myself, in it’s current form it’s probably 80% AI coded using Claude Code.

Prerequisites

  • Home Assistant 2025.8+ (required for AI Task integration)
  • Music Assistant integration installed and configured
  • An AI Task entity — configure an AI integration (e.g., Anthropic, OpenAI, Ollama) and enable its AI Task sub-entry

Installation

  1. Open HACS in Home Assistant
  2. Click the three-dot menu (top right) → Custom repositories
  3. Add repository URL: https://github.com/rjbutler/ha-ai-playlist
  4. Category: Integration
  5. Click Add, then find “AI Playlist” in HACS and click Download
  6. Restart Home Assistant

Full information at GitHub - rjbutler/ha-ai-playlist: AI-powered playlist generation for Home Assistant + Music Assistant · GitHub

I’m mostly using it with dashboards and scene controllers, not assist. I wanted more than just artists/albums and broad genres, and it didn’t seem like anything existing offered that when I started down this path. I think it’s a different approach than MA LLM, but maybe I didn’t dig deep enough when looking for what I wanted.