How to create a Volumio plugin, the easy way

Hi Folks! We’ve just published an handy tool to create plugins, mantain and update them in an easy way.

Basically, all you need to do is connect to Volumio via SSH and type:

volumio plugin

Those are the features:

init creates a new plugin refresh copies the plugin in the system package compresses the plugin publish publishes the plugin on git

This feature is available starting from version 2.185 .
You can find all the related documentation here: volumio.github.io/docs/Plugin_S … lugin.html

Good job!

That’s interesting … it might even tempt me have a go :wink:

Hi Michelangelo,

I’m trying

volumio plugin init

and I get this error

module.js:471
    throw err;
    ^

Error: Cannot find module 'inquirer'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/volumio/pluginhelper.js:4:16)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

How can I fixe this ?

On which version are you on?

I’m on the last version, uploaded tuesday.
On the UI of Volumio, I can see : 2.185

I think you must have manually edited some files, and those were not updated… For example, did you do a
volumio pull

or installed node modules manually?

In any case, to solve this: system-> delete user data

The only file, I’ve edited is “config.txt” for overclocking.

I’ll try this evening and tell you if “system-> delete user data” solves my problem.

Thanks

Sorry, my bad, I forgot to include the module on the RAM build.
Don’t do what I asked previously. You can use the dev updater to update to the new image which I am building now

or flash it:
updates.volumio.org/pi/volumio/2 … pi.img.zip

Michangelo,

Before I see your last post, I’ve made a new installation.
After I see your post, I install the last version : 2.191.

My previous error dessappears but I have 2 new errors :

1. Volumio Plugin

[code]root@volumio:/home/volumio# volumio plugin refresh

This command will copy all your plugin’s file in the correspondent folder in data

Updating the plugin in Data
Error, impossible to copy the plugin: Error: ENOENT: no such file or directory, open ‘package.json’
[/code]
2. Installation of plugins
Previouly, I’ve installed spotify, Youtube playback and IR Rmote controller plugins.
Now, I succeed to install Spootify but for the others I’ve the following error :[code]Installing Plugin

The following error occurred when installing the plugin: TypeError: Cannot read property ‘name’ of undefined
0%

  • Cacher les détails

Downloading plugin at http://127.0.0.1:3000/plugin-serve/571683cd-b41d-4939-8dc2-b3ec77718bf1.zip
END DOWNLOAD: http://127.0.0.1:3000/plugin-serve/571683cd-b41d-4939-8dc2-b3ec77718bf1.zip
Creating folder on disk
Unpacking plugin
The following error occurred when installing the plugin: TypeError: Cannot read property ‘name’ of undefined[/code]
In fact, there are installed and seems to work correctly.

I’ve also installed the Qobuz plugin found on your github repository with no error message.
I’ve configured with my credentials, I can see all the folders of Qobuz but nothing is operational.
Can you tell me if this plugin is working ?

Thanks for your answers.

Hi kiefer,

Error number 1: you need to run the volumio plugin refresh command in the plugin’s directory. If then it still doesn’t work, try as root.

Error number 2: I’m not sure what the problem is, but try running this on the volumio: sudo chown -R volumio:volumio /data

Could anyone provide some knowledge about my problem with .sh-scriots :slight_smile:?
running-with-onstart-and-onstop-t8152.html

I can’t seem to publish the new plugin using “volumio plugin publish”, am I trying too soon? Using version 2.348 on a Raspberry Pi 3.

[code]volumio@volumiolcd:~/volumio-plugins/plugins/user_interface/rotaryencoder$ volumio plugin publish

This command will publish the plugin on volumio plugins store

Publishing the plugin
? do you want to change your version? (leave blank for default) 1.0.2

*** Please tell me who you are.

Run

git config --global user.email “you@example.com
git config --global user.name “Your Name”

to set your account’s default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got ‘volumio@volumiolcd.(none)’)
Nothing to commit
Compressing the plugin
Plugin succesfully compressed
Switched to a new branch ‘gh-pages’
? Insert some details about your plugin (e.g. features, requirements, notes, etc… max 1000 chars) Installs basic rotary encoder functionality using only Node JS modules.

*** Please tell me who you are.

Run

git config --global user.email “you@example.com
git config --global user.name “Your Name”

to set your account’s default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got ‘volumio@volumiolcd.(none)’)
(node:14845) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: /usr/bin/git commit -am “updating plugin rotaryencoder 1.0.2”

*** Please tell me who you are.

Run

git config --global user.email “you@example.com
git config --global user.name “Your Name”

to set your account’s default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got ‘volumio@volumiolcd.(none)’)
[/code]

Another issue I’ve encountered is that when you init (create) a plugin the template is missing the following function:

pluginname.prototype.getConfigurationFiles = function() { return ['config.json']; };

Which results in the problem that no default config is placed, the following will not happen:

Error reading configuration. Defaulting to empty configuration

Also earlier the getConf function was used, but now the config is loaded in the onVolumioStart, are the following functions obsolete?

[code]pluginname.prototype.setUIConfig = function(data) {
var self = this;
//Perform your installation tasks here
};

pluginname.prototype.getConf = function(varName) {
var self = this;
//Perform your installation tasks here
};

pluginname.prototype.setConf = function(varName, varValue) {
var self = this;
//Perform your installation tasks here
};[/code]