As regular readers will know, I’m heavily invested in the Home assistant ecosystem in my house. I have lots of zigbee devices, tablets on most walls displaying or controlling things…. it’s a lot. I also have a few Amazon Echos scattered around, including one in the kitchen which I play music on when I’m cooking. Wouldn’t it be great (I thought) if I could play music through the echo and control it on the home assistant dashboard that’s already in there? Shouild be easy enough right?
So, first problem, how to connect home asistant to my streaming service of choice ‘Qobuz‘? (Note: I used to use spotify, but closed my account with them after they hosted Andrew ‘mega bastard’ Tate’s podcast). Well it’s not as easy as just installing a plugin, but there is a route to get Home assistant working with Qobuz (along with many other streaming services) and it’s Music assistant.
Music assistant needs installing either into HASS if you run the full home asistant OS or as a seperate container (asuming you’re using some sort of containerised setup, I use Unraid to host my many containers) following the instructions here. Once installed you should be greeted with something like this:

You want to install the relevant music provider (Qobuz for me) and set it up. Then install the home assistant plugin from the ‘plugins’ section and point it at your home assistant installation. You also want to install the ‘Music asistant’ plugin in home assistant (it’s an official integration, so you should be able to find it in devices / services and in fact it should be discovered automatically once your music asistant installation is up and running).
Then we need to install a player provider, and here’s where things got ttricky for me. Conceptually, a ‘player’ represents a piece of software running on a device that can play media. It’s uncoupled from the actual interface you use to play that music so you can, for example, create a media player card in a home assistant dashboard that controls an actual ‘player’ which is somewhere else entirely. Which is cool….but it means we need to figure out what our player is.
Finding a player
Should be easy right? We want to play our media on the Amazon Echo that’s in the kitchen, we have the ‘Alexa media player‘ plugin installed in our home assistant setup (that’s a custom integration btw, you can find it in HACs)….it ahould be as easy as selecting the echo as our player right? Wrong! Although workl has been ongoing since 2022 to add alexa media player support to music assistant, it’s not there yet, you can’t select an Echo as a player in music assistant.
So…my next thought was to use browser mod. If you’re not familiar with it, browser mod allows you to use the device you’re running your home assistant dashboards on as a media player. Sounds perfect right? Well…. kind of. With browser mod I could get a player to be discovered by Music assistant (it shows up in the home assistant provided players) and I can create a media player card that can connect to it (note here, you need to create music assistant player cards from the devices->music assistant->configuration->add to dashboard route otherwise the music assistant media can’t be browsed) but although initially this appears to work fine, 5 seconds into playing any media the timeline stops updating and, when moving to the next track the artwork in the player isn’t updated. It’s like no information about the playing track is sent to the interface after the initial play.
Then I tried the ‘fully kiosk’ integration with music assistant. Fully kiosk is an app that lets you run a website or app on an android tablet in a ‘kiosk’ mode, controlling the ability to navigate away from the site and so on. I use it on some of the home assistant tablets in the house because you can do cool things like only turn the screen on when motion is detected from the tablet’s camera. Which is nice. Anyway, music assistant has an integration that promises to treat fully kiosk on a tablet as a media player…and again, it kind of works. Same deal as with browser mod, can play tracks but the information doesn’t update after about 5 seconds. I alo tried different lovelace cards here (mini media player, maxi media player) to make sure it wasn’t the interface that was the problem, but I noticed the same thing happens on the built in music assistant interface, so it seems like it’s definitely a player issue.
Then I started to really go out of the box. Music assistant supports Airplay and google cast as targets, if I could get my tablet to pretend to be one of those……. and luckily there are plenty of apps that let your android tablet do that! And none of them worked for me. This might be because I’m using a fire tablet, although annoyingly the tablet running AirReceiver did show up as an ‘Apple TV’ in home assistant, but stubborinly refused to even be seen by music assistant.
So…it seems like all avenues of using the actual tablet as the player are closed, so let’s see what else we can do. I know music asistant supports airplay. I know I can connect to the echo using bluetooth. So what I need is something to sit in between them being an airplay receiver and playing audio through bluetooth. Actual airplay receivers are pretty expensive, and I don;’t like spending large amounts of money (much preferring to spend small amounts, many many times) so I wonder if I could use a raspberry pi (preferably a Zero 2 W since they’re cheaper!) to do this?
Connecting to Bluetooth
First part, lets get the Pi connected to bluetooth on the echo. For this I started following this guide, but unfortunately got “Package bluealsa is not available, but is referred to by another package.” when trying to install bluealsa. Luckily a bit of googling revelaed that in my OS at least the correct package is blue-alsa-utils.
sudo apt update && sudo apt upgrade -y && sudo apt install bluez-alsa-utils -y
sudo service bluealsa start
bluectl
To install and start the bluealsa service, and start the bluetooth control program. Your prompt should change to ‘Bluetooth’ to show this. Now we need to scan for the right device (put your echo into pairing mode using the alexa app here), pair it and trust it so it will connect again automatically. The commands you need are:
Scan on – starts scanning and shows you the MAC address of the device you want to connect to
Pair XX:XX:XX:XX:XX:XX – pairs with the mac address from the previous command
Trust: XX:XX:XX:XX:XX:XX – trust the mac address
Here’s an example with some of the extraneaous stuff trimmed out:
[bluetooth]# scan on
Discovery started
[CHG] Controller B8:27:EB:52:35:AC Discovering: yes
[NEW] Device 08:84:9D:17:39:3A 08-84-9D-17-39-3A
[CHG] Device 08:84:9D:17:39:3A Name: Echo Dot-HS2
[CHG] Device 08:84:9D:17:39:3A Alias: Echo Dot-HS2
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000111f-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001200-0000-1000-8000-00805f9b34fb
#[bluetooth]# pair 08:84:9D:17:39:3A
Attempting to pair with 08:84:9D:17:39:3A
[CHG] Device 08:84:9D:17:39:3A Connected: yes
[CHG] Device 08:84:9D:17:39:3A Bonded: yes
[CHG] Device 08:84:9D:17:39:3A Modalias: bluetooth:v0171p0180d0100
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001133-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device 08:84:9D:17:39:3A ServicesResolved: yes
[CHG] Device 08:84:9D:17:39:3A Paired: yes
Pairing successful
Authorize service
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 65:FC:29:5F:3F:BD RSSI: -90
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [NEW] Device 40:A8:20:C8:2D:82 40-A8-20-C8-2D-82
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 65:35:92:79:C4:D4 RSSI: -68
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 65:35:92:79:C4:D4 ManufacturerData Key: 0x004c
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 65:35:92:79:C4:D4 ManufacturerData Value:
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): 0c 0e 08 71 0b 30 33 7f 7f 3e 1d f6 72 2c d4 64 ...q.03..>..r,.d
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): 10 06 4d 1d bf 5a 09 48 ..M..Z.H
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 7A:B5:74:67:7B:90 RSSI: -85
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 7A:B5:74:67:7B:90 ManufacturerData Key: 0x004c
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 7A:B5:74:67:7B:90 ManufacturerData Value:
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): 0c 0e 08 71 0b 30 33 7f 7f 3e 1d f6 72 2c d4 64 ...q.03..>..r,.d
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): 10 06 4d 1d bf 5a 09 48 ..M..Z.H
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [NEW] Device 5E:10:7E:82:5D:08 5E-10-7E-82-5D-08
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 11:5E:74:0C:83:93 RSSI: -82
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 5A:69:53:02:23:78 RSSI: -96
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): [CHG] Device 7F:8B:4C:D3:51:6B RSSI: -90
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): trust 08:84:9D:17:39:3A
#[bluetooth]# trust 08:84:9D:17:39:3A
[CHG] Device 08:84:9D:17:39:3A Trusted: yes
Changing 08:84:9D:17:39:3A trust succeeded
#[bluetooth]# quit
Now lets tell Alsa that this device is our default for playing audio. We do that by editing /etc/asound.conf and adding the following (substituting the MAC address of your echo of course). I’ve called my speaker here ‘kitchen’, you can obviously call it whatever you like but remember the name because we’ll need it for our shairplay-sync server setup.
pcm.kitchen {
type plug
slave {
pcm {
type bluealsa
device 08:84:9D:17:39:3A
profile "a2dp"
}
}
hint {
show on
description "Kitchen Echo speaker"
}
}
Now we need to enable permissions to sink audio to the bluetooth device (I think that’s what this is doing. Without it, only a bluetooth capture card shows up. I found this tip here). In /etc/dbus-1/system.d/bluealsa.conf
<policy user="root">
<allow own_prefix="org.bluealsa"/>
<allow send_destination="org.bluealsa"/>
<allow send_destination="org.bluealsa.sink" />
<allow send_destination="org.bluealsa.source" />
</policy>
<policy group="audio">
<allow send_destination="org.bluealsa"/>
<allow send_destination="org.bluealsa.sink" />
<allow send_destination="org.bluealsa.source" />
</policy>
Now, you should be able to play sound from the echo using asound, like this (note we use the name we gave the speaker eariler)
aplay -D kitchen /usr/share/sounds/alsa/Front_Center.wav
And finally, Airplay
OKay, that’s the easy part done, we now (hopefully) have our raspberry pi connected to our Echo via bluetooth and playing audio! Now we just need to sort the airplay side of things out. For this I’ll be using ‘Shairport-sync’. Most tutorials I can find for this take you through downloading and building from source, but recent versions of Pi OS seem to have the package available so….
sudo apt-get install shairport-sync && sudo service shairport-sync start
Now we need to do a little bit of configuration to tell shairport-sync to use the bluetooth speaker (thanks to this comment for help here)
rename /etc/shairport-sync.conf to /etc/shairport-sync.conf-BAK and then create a new /etc/shairport-sync.conf containing this:
general =
{
name = "Kitchen Echo";
volume_range_db = 60 ;
};
sessioncontrol =
{
allow_session_interruption = "yes";
};
alsa =
{
output_device = "kitchen";
};
diagnostics =
{
log_verbosity = 2;
};
remember the ‘kitchen’ in output_device is the one we put in /etc/asound.conf earlier, and ‘Kitchen echo’ in the general section is what the airplay device will be presented as.
And that should be it! In the airplay players in music assistant you should see something like this:
