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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation or script, or select Create automation > Create new automation.
  3. 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.
  4. In the Then do section, select Add action.
  5. From the search box, search for and select Music Assistant: Search Music Assistant.
  6. Fill in the options you want to use.
  7. In the Response variable field, enter a name to store the movie data in, such as search_results.
  8. 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

Music Assistant instance

The Music Assistant instance to perform the search on.

Search name

The name or title to search for.

Media type(s)

The type of content to search for, such as artist, album, track, radio, or playlist. All types when omitted.

Artist name

When specifying a track or album name in the search name field, you can optionally restrict results by this artist name.

Album name

When specifying a track name in the search name field, you can optionally restrict results by this album name.

Limit

The maximum number of items to return per media type.

Only library items

Only include results that are in the library.

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:

ActionActions are used in several places in Home Assistant. As part of a script or automation, actions define what is going to happen once a trigger is activated. In scripts, an action is called *sequence*. [Learn more]
action: music_assistant.search
data:
  config_entry_id: 01JEXNDHT21V0BHJXM7A5SZANV
  name: "We Are The Champions"
response_variable: search_results

Options in YAML

config_entry_id string Required

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.

name string Required

The name or title to search for.

media_type string | list

The type of content to search for. One or more of: artist, album, audiobook, playlist, podcast, track, or radio. All types when omitted.

artist string

When specifying a track or album name in the name field, you can optionally restrict results by this artist name.

album string

When specifying a track name in the name field, you can optionally restrict results by this album name.

limit integer

The maximum number of items to return per media type.

library_only boolean

Only include results that are in the library.

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.

Tip

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.