How to add more ALSA sinks to cards.json


I managed to setup bluetooth A2DP connection to my bluetooth speakers using bluealsa and added the configuration to mpd.
And I’m able to use the speakers with third party mpd controllers where I can select the added sink.


audio_output {
        type            "alsa"
        name            "bluealsa"
        device          "bluealsa"
        mixer_type      "software"

I tried to add it also to volumio 2 gui but with no success right now.

What I tried ist to add the card to /volumio/app/plugins/audio_interfaces/alsa_controller/cards.json

{"name": "bluealsa", "prettyname": "Bluetooth speaker", "defaultmixer": "Software", "type": "integrated"}

What else needs to be done to have it appear in the settings?

cards.json is just to set “prettynames” for devices. What you need here is a plugin.
Take a look here, we can guide you if you need help: … rview.html

I started to create a plugin for controlling Bluetooth devices.

I took the sample from the link above and added the bluetoothctl to the dependencies.

  "name": "bluetooth",
  "version": "0.1.0",
  "description": "Manage Bluetooth connections",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  "author": "geeks-r-us",
  "license": "",
  "volumio_info": {
    "prettyName": "Bluetooth Manager",
    "icon": "fa-bluetooth",
    "plugin_type": "audio_interface",
    "boot_priority": 1
  "dependencies": {
      "fs-extra": "^0.28.0",
      "kew": "^0.7.0",
      "v-conf": "^0.10.0",
      "": "^1.4.5",
      "bluetoothctl": "^1.0.1"

Packaged everything into a zip file and tried to upload it. seem to be executed and the plugin is copied to /data/plugins/...
but after enabling the plugin I get the message 
May 01 21:23:42 volumio volumio[4853]: info: Enabling plugin bluetooth
May 01 21:23:42 volumio volumio[4853]: info: Loading plugin "bluetooth"...
May 01 21:23:42 volumio volumio[4853]: info: Error: Error: Cannot find module 'kew'
May 01 21:23:43 volumio volumio[4853]: info: CoreCommandRouter::getUIConfigOnPlugin
May 01 21:23:43 volumio volumio[4853]: /volumio/app/index.js:973
May 01 21:23:43 volumio volumio[4853]: return thisPlugin.getUIConfig(data);
May 01 21:23:43 volumio volumio[4853]: ^
May 01 21:23:43 volumio volumio[4853]: TypeError: Cannot read property 'getUIConfig' of undefined
May 01 21:23:43 volumio volumio[4853]: at CoreCommandRouter.getUIConfigOnPlugin (/volumio/app/index.js:973:19)
May 01 21:23:43 volumio volumio[4853]: at Socket.<anonymous> (/volumio/app/plugins/user_interface/websocket/index.js:503:36)
May 01 21:23:43 volumio volumio[4853]: at emitTwo (events.js:106:13)
May 01 21:23:43 volumio volumio[4853]: at Socket.emit (events.js:191:7)
May 01 21:23:43 volumio volumio[4853]: at Socket.onevent (/volumio/node_modules/
May 01 21:23:43 volumio volumio[4853]: at Socket.onpacket (/volumio/node_modules/
May 01 21:23:43 volumio volumio[4853]: at /volumio/node_modules/
May 01 21:23:43 volumio volumio[4853]: at _combinedTickCallback (internal/process/next_tick.js:67:7)
May 01 21:23:43 volumio volumio[4853]: at process._tickCallback (internal/process/next_tick.js:98:9)
May 01 21:23:43 volumio mpd[586]: client: [2] closed
I had a look what npm gives me:
[code]npm list
bluetooth@0.1.0 /data/plugins/audio_interface/bluetooth
+-- UNMET DEPENDENCY bluetoothctl@^1.0.1
+-- UNMET DEPENDENCY fs-extra@^0.28.0
+-- UNMET DEPENDENCY kew@^0.7.0
`-- UNMET DEPENDENCY v-conf@^0.10.0

npm ERR! missing: fs-extra@^0.28.0, required by bluetooth@0.1.0
npm ERR! missing: kew@^0.7.0, required by bluetooth@0.1.0
npm ERR! missing: v-conf@^0.10.0, required by bluetooth@0.1.0
npm ERR! missing:^1.4.5, required by bluetooth@0.1.0
npm ERR! missing: bluetoothctl@^1.0.1, required by bluetooth@0.1.0

I looks like as the base problem is that kew and the other dependencies are not installed.

So my question is do I need to provide some code in to install it using npm install … or should this be done by the plugin manager?

You have to provide all needed node modules for the plugin. Have a look at other plugin .

Please see the docs: … lugin.html

Oh I have not recognized that during reading the page. My bad.

I managed to add config options like setting bt discoverable.

But how do I send the list of found devices to the config page like it is done for wireless networks?

I have seen there is a member of the network controller that gathers it from iwscan but from where is it triggered?

Ok I understand the coreSection mechanism now.

It seems as I won’t be able to dynamically update the content of UIConfig Page without extending the websocket core plugin, right?
Are there any other option how I can add such a list of bluetooth devices to the plugin?

Or should I start to implement it as core plugin. E.g. by extending the alsa_controller with bluetooth sections which are visible when a bluetooth device is available?

You need to create your own plugin I believe, this way you could set playback to the bluetooth audio. Or, create a fake soundcard with snd_aloop to reroute the sound to bt. This way you can select the audio device accordingly

What I tried and worked well is to add the bluetooth device (if it’s a a2dp speaker) to mpd. conf

like this:

audio_output {
        type            "alsa"
        name            "bluealsa"
        device          "bluealsa"
        mixer_type      "software"

Pro: this solution it should use lesser CPU than an snd_aloop
Con: it also needs to extend the mpd.conf.tmpl by this section and requires a restart of mpd after changeing the device

We can add an API to extend the soundcards… But it will not be a quick thing…

Made some progress on adding Bluetooth to Volumio.
An initial version can be found here:

It would be nice to hear any feedback on this


great news.

What should I do to use it?

1.) setup bluezalsa

For RPI3 the following script should work


echo "Installing Bluetooth Dependencies"
sudo apt-get update
sudo apt-get install -y libasound2-dev dh-autoreconf libortp-dev bluez pi-bluetooth bluez-tools libbluetooth-dev libusb-dev libglib2.0-dev libudev-dev libical-dev libreadline-dev libsbc1 libsbc-dev

echo "Cloning Bluez-Alsa repo"
cd /tmp
git clone

echo "Building Bluez-Alsa"
cd bluez-alsa
autoreconf --install
mkdir build && cd build
../configure --disable-hcitop --with-alsaplugindir=/usr/lib/arm-linux-gnueabihf/alsa-lib

echo "Installing Bluez-Alsa"
sudo make install

cat > /lib/systemd/system/bluezalsa.service <<EOC
Description=BluezAlsa proxy
ExecStart=/usr/bin/bluealsa --disable-hfp

sudo systemctl daemon-reload
sudo systemctl enable bluealsa.service

#requred to end the plugin install
echo "plugininstallend"

2.) clone my volumio repository to /volumuio
3.) build the new ui and deploy it to the volumio directory

I gave a look at your code, and, congratulations, you made everything in a perfect Volumio style. Also, very good the integration on the UI.
I suggest this approach:

  • Instead of merging the Volumio 2 backend commit, we can create a plugin out of it (which you basically already did)
  • We merge the UI part, so we can invoke it when the plugin is installed

This is because we try to keep Volumio2 base code as essential as possible, allowing to install more stuff only if people really needs it. What do you think? We can do it together.

My congratulations again!


for me it would also be OK to move it to a plugin.
The only thing I’m not aware about that is how to move the stuff implement the user interface / web sockets part to a third party plugin?

We can merge the UI (it will be enabled on demand with the code you made). As for the websocket we can use the callMethod function


I build an plugin and added the callMethods to UI. Initial query of BT devices is sent to plugin and an answer is generated.
But how can I receive the push anwsers of such a methods?
In the API Docs a pushMethod is mentioned but I can’t find an example of it in the code.

Will the Bluetooth Plugin be added ro volumio?
If yes can the Time be estimated?

Trank you

Hi there,

great work!
I’ve been fiddling around with bluetooth for some time now and finally managed to test your “git” version.
A couple of things are not working for me (eg. invalid .asounrc is created; /n at the end instead of \n I guess; connecting not working; …).
Should I continue to test and post my findigs here, or wait for a more mature plugin status?

Regards, stm


the content of the repository is a hard integration into volumio what is not the desired solution of this project.
Currently I’ll rewrite the hard integration to a plugin. and got stuck a little on the return of the device list over the callMethod call.
But I keep trying to find a solution and post a new working plugin version.

I’ll plan to publish it in the plugin repository but I can’t give a time estimation right now because I just move and the workspace is not restored completely.