Search Music Assistant
Use this action to search the Music Assistant library and all connected providers at once. This gives you programmatic access to the full catalog of your music providers, which you can use to build a dashboard where any track can be found and played.
This action returns its result in a response variable, which you can use in later steps of the same automation or script. It does not change anything on a player.
Using this action from the user interface
If you prefer building automations and scripts visually, Home Assistant walks you through this action step by step. You pick what to target, tweak a few options, and save. No YAML knowledge required.
To search from an automation or a script:
- Go to Settings > Automations & scenes.
- Open an existing automation or script, or select Create automation > Create new automation.
- If you’re setting up a new automation, add a trigger in the When section. Scripts don’t need a trigger. They run when something else calls them.
- In the Then do section, select Add action.
- From the search box, search for and select Music Assistant: Search Music Assistant.
- Fill in the options you want to use.
- In the Response variable field, enter a name to store the movie data in, such as
search_results. - Select Save.
This action does not support targets. In the UI, you are not prompted to choose an area, device, entity, or label. You select the Music Assistant instance through the Music Assistant instance option instead.
Options in the UI
The type of content to search for, such as artist, album, track, radio, or playlist. All types when omitted.
When specifying a track or album name in the search name field, you can optionally restrict results by this artist name.
When specifying a track name in the search name field, you can optionally restrict results by this album name.
Using this action in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, refer to this action as music_assistant.search. A basic example looks like this:
action: music_assistant.search
data:
config_entry_id: 01JEXNDHT21V0BHJXM7A5SZANV
name: "We Are The Champions"
response_variable: search_results
Options in YAML
The ID of the Music Assistant instance to perform the search on. Select the instance from the dropdown in the visual editor, then switch to YAML to read the value.
The type of content to search for. One or more of: artist, album, audiobook, playlist, podcast, track, or radio. All types when omitted.
When specifying a track or album name in the name field, you can optionally restrict results by this artist name.
When specifying a track name in the name field, you can optionally restrict results by this album name.
Response data
The action returns lists of matching items, grouped by media type: artists, albums, tracks, playlists, radio, audiobooks, and podcasts. Each item includes details such as its name and URI, which you can pass to the Play media action.
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the action you’re calling and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain actions or suggest the right one when you describe what you want in plain language.
Related actions
These actions work well alongside this one:
-
Get library items: Retrieves items from a Music Assistant library.
-
Play media: Plays media on a Music Assistant player with fine-grained control options.