How do I…?
Section titled “How do I…?”Get the URI?
Section titled “Get the URI?”For playlists, artists, albums and radio you can simply use the name.
For tracks you can use the name but that may result in ambiguous responses so you can limit by artist name by using Billy Joel - A Matter of Trust. If that is still ambiguous, then the action has additional options which you can use to further restrict the search. For example:
data: media_type: track media_id: Running on Ice artist: Billy Joel album: The BridgeSimilarly, if the album name is ambiguous you can specify the artist name first (Queen - Greatest Hits)
You can also use the music_assistant.search or music_assistant.get_library actions and the URI will be shown in the results. The URI is also shown in the Provider Details section at the bottom of the item views and can be copied to the clipboard using the chain link icon.
NOTE
URIs which begin with media-source:// are HA URIs and should not be used when targetting MA player entities. Doing so will result in inconsistent behaviour.
URIs for folders need to be constructed in the form filesystem_id://folder/relative/path/to/folder (e.g. filesystem_smb--5iJ4npRi://folder/ABBA), The filesystem_id can be obtained by reviewing the output of the get_library action. Scan for the key tracks.provider_mappings.provider_instance and find one that shows the filesystem_id. Having said that, if there is only one file system source added to MA then filesystem_smb can be used.
Use volume normalization? How does it work?
Section titled “Use volume normalization? How does it work?”After a track has been played by MA once then data is retained for volumes to be normalised across all tracks being played. The setting in MA is the target level for the volume normalisation. MA does not compress the dynamic range (because that is bad for quality) but just adjusts the gain of the entire track based on its overall loudness as measured by the EBU R128 standard. A greater negative value will typically make the track sound less loud but leaves a lot of headroom. However, for each individual track the gain could rise or fall to ensure that the overall loudness of all tracks played is at the selected level. It is recommended to use a value between -23 and -17 LUFS (and -17 is the default starting point). Do not set it too high (close to zero) because that can make your music sound distorted due to clipping.
More details here
Have my music continue if I change rooms
Section titled “Have my music continue if I change rooms”There are three options.
-
Start streaming to any type of group that includes all the rooms you will move between. Mute all the rooms except the one you are in. When you move rooms just mute and unmute the required players.
-
Use a Sync Group with the dynamic members option turned on, or a Manual Sync group. As you change rooms then join the new room to the existing group. What to do with the other players in the group depends upon the group type and whether the player is the group leader (Sync Group) or holds the queue (Manual Sync). The options are unjoining the player from the group or muting it. For more information read up on Groups
-
Use the Transfer Queue action.
Shuffle Spotify/Playlist/YouTube etc
Section titled “Shuffle Spotify/Playlist/YouTube etc”You don’t shuffle the music sources you enable shuffle on the queue for the player and then whatever gets added to the queue gets shuffled. You enable shuffle on the queue from within MA by selecting the Shuffle Icon on the Player Bar or you can select the NOW PLAYING View, then the context menu Top Right then ENABLE SHUFFLE or you can do it with yaml as follows:
action: media_player.shuffle_settarget: entity_id: media_player.mass_bathdata: shuffle: trueAdd items to the queue via a script or automation
Section titled “Add items to the queue via a script or automation”action: media_player.play_mediatarget: entity_id: media_player.mass_player_entity_goes_heredata: media_content_id: NameOfTheAlbumArtistOrPlaylistHere media_content_type: musicSee here for enqueue options
See also music_assistant.play_media action
Start a playlist with a script
Section titled “Start a playlist with a script”Use the media_player.play_media action shown above or music_assistant.play_media action as described here.
Play a Random Item
Section titled “Play a Random Item”Use get_library and an script/automation such as this:
sequence: - action: music_assistant.get_library data: media_type: track search: ARTISTNAME limit: 1 order_by: random response_variable: random_track - action: music_assistant.play_media data: media_id: "{{ random_track['items'][0].uri }}" media_type: track enqueue: play radio_mode: true target: entity_id: media_player.ma_kitchen_speakerIf you want a queue of tracks then:
sequence: - action: music_assistant.get_library data: media_type: track search: ARTISTNAME limit: 10 order_by: random response_variable: random_tracks - repeat: count: "{{ random_tracks['items'] | length }}" sequence: - action: music_assistant.play_media data: media_id: "{{ random_tracks['items'][repeat.index - 1].uri }}" media_type: track enqueue: add target: entity_id: media_player.ma_kitchen_speakerThis could be modified for other item types (e.g. radio stations or playlists).
Clear the queue with a script or automation
Section titled “Clear the queue with a script or automation”Use the HA action of media_player.clear_playlist or the new music_assistant.play_media action and select the appropriate enqueue option if wanting to clear the queue and play something else.
Add radio stations to MA
Section titled “Add radio stations to MA”If you use the TuneIn provider then stations that are favourited in your account will appear.
If you use the RadioBrowser provider then BROWSE the provider and select ADD TO LIBRARY for the station desired.
Direct entry of stations can be done by navigating to the Radio view and selecting ADD ITEM FROM URL in the menu at the top right. This will also work for locally hosted streams such as from Icecast.
NOTE
The newly added station(s) will not appear until the Radio view listing is refreshed manually from the top right menu.
Start a radio stream with an automation
Section titled “Start a radio stream with an automation”Use the music_assistant.play_media action and set the media_id as the station name.
Go to next/previous radio station via a script
Section titled “Go to next/previous radio station via a script”Create an input_select with the various radio stations as options. Now you can use next and previous actions to switch between the stations.
To generate the list of radio stations dynamically use a suitable automation trigger and a script such as this:
script: generate_station_list: mode: queued alias: "Generate Station List" sequence: - action: music_assistant.get_library data: limit: 40 config_entry_id: 01JMYCMQJ55CR9E7YZW3VKEA4F media_type: radio favorite: true order_by: name response_variable: radio_stations - action: input_select.set_options target: entity_id: input_select.radio_station_list data: options: "{{ radio_stations['items'] | map(attribute='name') | list }}"Create playlists or use M3U files
Section titled “Create playlists or use M3U files”You can create playlists from the MA UI. Adding items can also be done from the UI.
If wanting to create playlists manually acceptable formats are:
(file in same folder as playlist):05 Blue Christmas.flac
and this (file is in subfolder relative to the playlist file):Elvis Presley/Blue Christmas/05 Blue Christmas.flac
and this (file has an absolute path):/Users/marcel/media/music/b05 Blue Christmas.flac
and this (full uri):spotify://track/12345orfilesystem_smb://track/blahRelative paths to the playlist (e.g. ../Mariah Carey/Merry Christmas/02 All I Want for Christmas Is You.flac ) also work.
M3U, M3U8 and PLS playlists are supported. VLC can be used to easily create playlists that MA can use.
Stop the music after a period of time aka Sleep Timer
Section titled “Stop the music after a period of time aka Sleep Timer”sequence: - wait_for_trigger: - platform: state entity_id: - media_player.mass_all_rooms attribute: media_title continue_on_timeout: false - action: media_player.turn_off data: {} target: entity_id: - media_player.mass_all_roomsmode: singlealias: Stop after current trackThanks to AAsikki who showed us here
Use MA with Mopidy
Section titled “Use MA with Mopidy”See here https://github.com/orgs/music-assistant/discussions/439
Run MA when I have SSL setup on my internal network?
Section titled “Run MA when I have SSL setup on my internal network?”Trying to run MA with SSL is not recommended. Having said that, whilst you can not run the stream service behind SSL you can configure the frontend entirely to your requirements. The default is that the frontend is protected by Ingress in HAOS. For those using docker, it is possible to host the webserver on a desired port and then run a (Ingress) reverse proxy. No support will be provided for these setups, we recommend you use HAOS.
Get the MA icon in the HA sidebar?
Section titled “Get the MA icon in the HA sidebar?”If you are running the MA app within the HA host go to SETTINGS>>ADDONS>>MUSIC ASSISTANT and select “Show in sidebar”.
If you are using docker then you can use an iframe panel or you can use another custom integration called hass_ingress which allows you to add additional ingress panels to your Home Assistant frontend. If using direct URLs a long lived access token will be required.
Add a rotary encoder with push button to a piCorePlayer
Section titled “Add a rotary encoder with push button to a piCorePlayer”See here
Access my music on Nextcloud?
Section titled “Access my music on Nextcloud?”The Nextcloud Music App supports Subsonic so you can use that source in MA to connect.
Access the MA Views directly via URL
Section titled “Access the MA Views directly via URL”If authentication becomes a blocker to some devices then create a long lived access token via MA SETTINGS >> PROFILE and use the following format as the URL https://192.168.1.1:8095/?code=xxx#/home/?player=kitchen%20speaker&showFullscreenPlayer=true where xxx is the token
Open the UI with a Specific Player Selected
Section titled “Open the UI with a Specific Player Selected”A specific player (or the last known) can be selected when opening the view by adding player= to the home URL. You can use a MA player name or true to open the last known. Player names are not case sensitive.
Examples
Open the UI Without Menu or Player Bar
Section titled “Open the UI Without Menu or Player Bar”Display the relevant view without the Player Bar or Main Menu
Examples
- http://192.168.1.1:8095/#/albums?frameless=true
- http://192.168.1.1:8095/#/playlists?player=kitchen%20speaker&frameless=true
Open the UI with the Now Playing View Showing
Section titled “Open the UI with the Now Playing View Showing”Display the Now Playing view
Examples
- http://192.168.1.1:8095/#/home?player=true&showFullscreenPlayer=true
- http://192.168.1.1:8095/#?player=true&showFullscreenPlayer=true
- http://192.168.1.1:8095/#/home?player=Livingroom&showFullscreenPlayer=true
Create Multiple ShairportSync-Instances on the same Host
Section titled “Create Multiple ShairportSync-Instances on the same Host”A tutorial is available here
Create a Stereo Pair
Section titled “Create a Stereo Pair”If a Player Provider supports stereo pairs natively, and these can be setup in the native app, and MA can detect these unique “players” then this should work. Otherwise, for the player providers that support perfect sync and show the Output Channel Mode in the Protocol Settings for the individual player then each player of the stereo pair can be assigned an individual channel and then the two players grouped as a Sync Group.