Skip to main content

Build your first plugin

BetaThe plugin SDK and these pages are new. They change with each release, as developers use them and tell us what works.View as Markdown

In this guide you create a plugin called Hello Volumio, check it the way the plugin store does, and run it on your own Volumio. The plugin writes a greeting to the Volumio log, and users can change the greeting in its settings page. It takes about ten minutes.

Prerequisites​

  1. Install Node.js 22 or later.
  2. Have a Volumio 4 device on the same network as your computer. You need its IP address, such as 192.168.1.20.

1. Create the plugin​

Open a terminal and run init from the Volumio plugin SDK:

npx --package=@volumio/plugin-sdk volumio-plugin init hello_volumio \
--id hello_volumio --type miscellanea --function http-caller \
--title "Hello Volumio" --description "Writes a greeting to the log"

Each option sets one field of the plugin:

OptionWhat it sets
--idThe plugin's name on the device. Letters, digits and underscores, no hyphens.
--typeThe kind of plugin. miscellanea is for a plugin that fits no other type.
--functionThe job the plugin does, from the function registry. This guide borrows http-caller. When no function fits your plugin, use a new id in lowercase words joined by hyphens: check reports it as a warning.
--titleThe name users read in the plugin store.
--descriptionThe sentence under the name in the plugin store.

init writes the plugin into a new folder, hello_volumio, and installs its dependencies:

.gitignore
AGENTS.md
CLAUDE.md
LICENSE
README.md
UIConfig.json
VOLUMIO_API.md
config.json
i18n/strings_en.json
index.js
install.sh
package.json
test/plugin.test.js
test/volumio.js
uninstall.sh
volumio-plugin.json

added 10 packages in 1s
✔ hello_volumio in hello_volumio: edit volumio-plugin.json and index.js, then npm test and volumio-plugin check

The plugin already runs on Volumio and passes every check. Plugin files explains what each file holds.

Move into the folder:

cd hello_volumio

2. Run the tests​

The plugin comes with tests that run it against a fake Volumio on your computer:

npm test
✔ every lifecycle method returns a kew promise (1.219833ms)
✔ the settings page shows the saved greeting, and Save stores a new one (1.394333ms)
✔ test/volumio.js (21.267417ms)
ℹ tests 3
ℹ pass 3
ℹ fail 0

3. Check the plugin​

check runs the same checks the plugin store runs on every pull request:

npx --package=@volumio/plugin-sdk volumio-plugin check .
✔ hello_volumio (v2): no errors, no warnings

When a rule fails, check names the rule, the file and the line, and says how to fix it. For example, a console.log in index.js gives this result:

✖ hello_volumio (v2): 1 error, no warnings
error G2.js.console-log index.js:82 console.log bypasses the Volumio logger
fix: Log through this.logger

Plugin rules lists every rule.

4. Change the greeting​

Open config.json. It holds each setting of the plugin with its default value:

config.json
{
"greeting": { "type": "string", "value": "Hello from Volumio" }
}

Change the value to Hello from my first plugin and save the file. When the plugin starts, onStart in index.js writes this greeting to the log.

5. Run it on your Volumio​

deploy builds the plugin, installs it on your Volumio and starts it. Replace 192.168.1.20 with the IP address of your device.

npx --package=@volumio/plugin-sdk volumio-plugin deploy 192.168.1.20 .

The device reboots to load the new code, so the music stops for a minute or two. deploy prints each stage, then the lines the device logged about the plugin while it started:

✔ hello_volumio: no errors, no warnings
Installing hello_volumio on 192.168.1.20
Rebooting 192.168.1.20 to load the new code: this takes a minute or two
Starting hello_volumio
...
✔ hello_volumio is running on 192.168.1.20

In the device log, find the line with hello_volumio: Hello from my first plugin. That line comes from your plugin.

Open the Volumio web UI and go to Plugins › Installed Plugins. Hello Volumio is in the list. Open its settings, type a new greeting and select Save.

Next steps​

Was this page helpful?