The past few days I've been struggling with building a volume controller plugin for volumio. My initial routine would be something like:

  • edit the source code on a PC
  • zip the code and some node_modules bundled from another plugin
  • load the plugin in volumio

This presents several issues:

  1. Slow deployment cycle (even if partially automated)
  2. Unable to restart volumio without rebooting

New way

I've been looking for more info and I've devised a new process:

Create the plugin on the raspberry pi

You need to download all the prerequisites (e.g. make, gcc...). volumio already has node installed. Once this is done, you need to create your plugin:

  1. Run volumio plugin init twice on the raspberry pi
  2. Push your code somewhere safe (e.g. bitbucket or github)
  3. Deploy the plugin to see it's working using volumio plugin refresh

Prepare the environment

I figured volumio has samba installed. I've added:

[DEV]
comment = Volumio development home
path = /home/volumio
browseable = yes
writeable = yes
create mask=0777
directory mask=0777
public=no

Once that's done, you'll need a relevant samba user. Use something like smbpasswd -a volumio and enter the desired password twice.

If you're on windows, then you can map the drive to a letter. If you're on OSX or Linux, then just mount the folder somewhere relevant. Now you can open the relevant folder in e.g. VS Code and you're ready to go for development.

Deployment cycle

My deployment cycle looks like this:

  • Open a ssh connection to raspberry pi (RASPI)
  • go to the folder where your plugin is (e.g. /volumio/volumio_plugins/plugins/accessory/my_plugin)
  • As long as needed
    • Edit code (PC)
    • Perform a npm install if you change dependencies (RASPI)
    • Type volumio plugin refresh to deploy (RASPI)
    • Type volumio plugin restart to restart volumio (RASPI)
  • Once you're satisfied, push the code to your repository
  • If you have a worthy release, then volumio plugin package and eventually volumio plugin publish

NOTES

  • The volumio command currently has a bug: the stop) switch calls a function stop which is not defined. You need to edit the code to vstop
  • The restart is required in my case because the plugin fails to reload (the index.js code)
  • The dependent modules need to be installed on raspi. I've tried on PC, but binary modules like the GPIO library need to be compiled natively on the raspberry pi.
  • Since you don't need local prompt, you can use your environment's terminal to to the remote commands :)

HTH,