Repeat single and mute in Websocket API

Hi folks,

I’m trying to make an extended version of the GPIO buttons plugin with the addition of repeat, random and mute buttons.
I’ve got random and repeat-all working, i.e.,
socket.emit('setRandom', {"value":true});
but am having trouble with repeat-single.
I used sudo journalctl -f to see that when I use the repeat button on the touchscreen and cycle it, when it goes to repeat-single mode, the log shows:
info: CoreStateMachine::setRepeat true single true

How can I set this using the API? I’ve tried things like this:
socket.emit('setRepeat', {"value":true, "single":true});
but it doesn’t work and the log shows:
info: CoreStateMachine::setRepeat true single undefined

Do I just have the syntax wrong, or is this nor available through the API?

On a similar note, is there an API command to toggle mute on and off, or will I need to store the current volume and then set to zero / restore saved value to unmute?
I saw the following in the log when using the UI to mute / unmute:


I did not test it, but it could be “repeatSingle” instead of “single”:

socket.emit('setRepeat', {"value":true, "repeatSingle":true});

Also not verified from my side:



1 Like

Ah, thanks. I’ll try repeatSingle when I get home later.
I tried mute last night but that didn’t work - Unless the changes just didn’t ripple through.
I’ve been having trouble with workflow - I’ve been doing
volumio plugin refresh
volumio plugin restart
after editing my files in volumio-plugins/plugins/system_controller/gpio-buttons-plus but that only seems to sporadically actually push changes through - a few times, the only way I’ve been able to get changes to work is by uninstalling and reinstalling the plugin.
I’m clearly doing something wrong - any hints as to what I’m missing please?

I would save the files belonging to the plugin you’re working on in e.g. “~/gpio-buttons-plus”. Then edit the files from there. After that execute volumio plugin install respectively volumio plugin refresh ( In my experience it is also necessary to run volumio vrestart to have Volumio “recognize” the changes. But it is not necessary to uninstall/reinstall the plugin.

Hm, just looked it up here and it is listed there.

I almost certainly just did something else wrong when I tried mute - I’ll experiment a bit later.
Thanks for the tip on working in ~/, does volumio plugin install just not do a full installation if other things are up to date (i.e., if I don’t uninstall first)?

Just tested the commands from post #2. They all work as expected.

Regarding volumio plugin install: I head in mind that you possibly download the .zip file of the GPIO buttons plugin to volumio’s home directory, unzip the files to e.g. “~/gpio-buttons-plus”, then work on these files and after that want to install the plugin. After the plugin has been installed use the refresh command and after it has finished volumio vrestart.

1 Like

Those commands in post #2 are working for me now, thanks!
I’ve moved the folder to ~/ as you suggested and after refresh and vrestart, the changes have taken effect immediately, so that should make my life waaaay easier now.

Originally I followed the plugin guide and cloned the whole plugins repository, then used volumio plugin init to make a new plugin called gpio-buttons-plus, then copied the config.json, UIconfing.json and index.js from the gpio-buttons plugin and edited the dependencies in package.js. It was dirty, but I got it to work eventually lol.
I’ve done a fair bit of js before but I’m very fresh when it comes to linux and npm.
You’ve given me a great headstart though, so thanks again!

1 Like