Amplifier Switch Plugin

Dear community,

I’m happy to present my first plugin to you. The Amplifier Switch was born out of a need: I’m using an external Class-D amplifier that will be inaccessible in in it’s final case. While the RPI with volumio should be powered all the time, the amp clearly shouldn’t. I also didn’t want to turn the amp on/off by hand every time.
Once activated, the AmpSwitch plugin will listen for status changes in the player and automatically turn on/off a user-selected output when music starts/stops. This way AmpSwitch will make your volumio behave like the amplifier is always on, with the power saving as if you would turn it on/off by hand every time.
As some amplifiers may require an inverted signal, the settings of AmpSwitch allow you to set it to inverted mode.

You can download ampswitch for volumio here.
If you encounter any bugs using AmpSwitch, please report them on GitHub.


great plugin!
Would it be possible to add a (variable/user-specified) pause before the amp is switched-off?
Can I add a line of code in index.js or is it more complicated than that?
Any hints or tips would be much appreciated!
Thanks for this great plugin!

Sorry for the delayed reply, didn’t check back for a while. I also thought about adding a delay, but wasn’t sure whether it was actually something that someone would be interested in. It’s a little more complex, but not much. I’ll try to add it in the next few days

Outstanding! This is a great plug is as is, but a delay (5 - 10s? Ideally user specified) would make it even better. I’ve been using this for a while an it works perfectly, but whenever I switch playlists/ radio streams/ etc., the amp power cycles. Not the end of the world, but a little bit irritating. A short delay would fix that completely.

Thanks for the great work!

Interesting, thanks for the bug report. Regardless of any delay, it shouldn’t power cycle when changing play source. Can you give some more details on when this happens? After every song? Only when changing song manually? With songs in one playlist? This will help a lot to trace what’s going on.

Hi Fightclub,
great news! a user-defined delay would be perfect! I am looking for a delay of 15 to 30 minutes. I don’t mind my amps to be switched on for quite a while (class D). I’d just like them to be turned off automatically over night or when we are on vacation and so on. I tried to forget to switch them off. :wink:
Again: great plugin and thanks a lot!!
regards Stephan


I’m not sure I’d call it a bug … I’d have reported an issue on your GitHub in that case. As near as I can tell, the plug is is performing perfectly to specifications. If I’m playing a predefined playlist, everything is perfect … no power cycles between tracks. But If I command volumio to play something else (different track, new playlist, different webradio stream, etc.), then for a second or three (while volumio is figuring out how to get its act together and follow the new instructions), playback stops. And when playback stops, your plug-in says “Turn off the amplifier!”, just as its supposed to. And then when playback resumes, the amp comes back on and all is right in the world again (well - at this little corner of it anyway). As I said, only mildly annoying, and far less so than either leaving the amp on all the time or switching it manually! Now if Amplifier Switch were to wait a few seconds before powering down … that would be perfection! I’d be happy with 5-10 seconds, Stephan sounds like he’d prefer 900s-1800s, a bit long for my taste, but I could live with that. Optimal, however, would be a user definable shutdown delay.

As I said before, great plug in … use it all the time. With or without the enhancement of a (user defined?) shutdown delay, I will continue happily using it with many thanks to you!

I’m wondering how easy this would be to adapt this plugin to use for a smartplug scenario? Instead of using GPIO it would send a UDP command to the smart plug?

Hey guys, sorry for the delay, couldn’t find the time to implement this, yet. But I didn’t forget about it.
Considering the smart plug, this totally depends on the smart plug that’s being used. If it’s really just a simple UDP package that needs to be send it’s fairly simple. But for the majority of large brands I doubt that it’s that easy. If they use some form of proprietary protocol than it all depends on whether there is a library that you can call.

Hi. I try to download this but i get " error 404 page not exist". Will this plugin be available to download again?

Good news, thanks to spyking, I just submitted a pull request to incorporate the switch-off delay. :slight_smile:

The free web server I set up for the download deactivated itself. However, you can always download the plugin via the official plugin section of your volumio.

Great! Thanks very much for implementing this enhancement. I look forward to trying it out as soon as I’m able, and will report back.

This lead me to my next question … as noted previously, your download server seems to be off the air. It seems that you’re suggesting the plug in should be available from the plug-in manager in Volumio but I’ve never seen it there. I’ve always had to download and install manually. Should it, if fact, be in the plug in manager?

Thanks again!

Hi, I also faced problem when tried to download this plugin. Could you please upload again?

Thanks in advance,

regards, Zoltan

@Fightclub - It’s easy to build on the work of others! Enjoyed the plugin, but needed the delay for my amp!

Also, prepared a zip available on github.
While the plugin is in the official repo - it is not published to the Volumio plugin store, so you can’t install it from the webinterface yet,

The plugin repo is quite challenging for people with little git experience!

Wow, its a great tool :slight_smile:
Thanks a lot…

Perfect! I’ve now had a chance to test this and it does exactly what I wanted. Many thanks to Fightclub and also to spyking for getting the zipfile together. The plug-in is now pretty much perfect, at least as far as my use-case is concerned. Two minor additional suggestions:

  1. If I understand the situation correctly (which I may not!) the former download link is permanently broken. If this is the case it would be worth updating the download link in the Volumio 2 plugins collection thread ( volumio-plugins-collection-t6251.html#p30923 ). That’s generally my first stop if I’m looking for a plugin. Even better would be to do whatever is required to get AmpSwitch to show up in the plugin search UI, but I’ve got no idea what that would entail.

  2. This is a really minor point , but specifying the delay in ms is probably a bit more granular that most users will be looking for. When I first set up the plugin, I set the delay to 10 and then thought it didn’t work. Eventually I figured out the delay was in ms (not seconds), set the delay to 10000, and all was right in the world. Perhaps there’s a technical reason why its easier to specify the delay in ms, or maybe there are users who actually need/want ms delay times, but I think it may be more intuitive to people who don’t always read the instructions to specify the delay in seconds. That said, once I figured it out, I set my desired delay and everything works great.

Thanks again for the useful plugin!


As far as I understood, it should be available via the UI of volumio, so I’m a bit irritated. I thought the git would be subject to nightly builds which would be served to the plugin search. However, I uploaded the zip file to my dropbox, where it should be available permanently and edited the referred post. I also added spyking’s GitHub link as mirror, in case something breaks again.

Both is easily feasible, it’s just the fact that the delay function accepts delay in ms by default. We could multiply this by 1000, but specifying it in ms does not really restrict the use, it just allows for a finer specification of delay. But that’s my computer science-biased point of view.

I think that that would require the Volumio devs to manually publish the plugin list form the git. Personally, I find the Volumio plugin git quite messy, would be so much neater if each plugin had it’s own repo, instead of having every plugin’s git history messed up with other commits. Maybe the volumio devs should look into a package manager structure such as node, Atom or Platformio?

I am unsure if the Volumio UI allows for more UI control - say a tab to switch from seconds to milliseconds? I for one have a delay to 1250ms :smiley: So am quite happy with the finer control. Maybe we could incorporate the unit of the delay in the setting string itself to make it more obvious to first time users?

Well then - I guess there actually are people that want/use sub-second specification of the shutdown delay! Very well then - I officially withdraw my suggestion to specify the delay in second as opposed to ms. Actually putting a switch into the UI would be massive overkill and completely unnecessary. Specifying the delay is ms is fine as long as we all know that’s what were doing. A really simple solution to this problem … just modify the label on the UI element from “Delay” to “Delay (ms)” to remove the ambiguity.

UPDATE: I just took a stab at fixing this myself, and it worked! (well, sort of) … I changed the relevant line in strings_en.json from:
“DELAY”: “Delay”,
“DELAY”: “Delay (ms)”,

and that’s all it took. The only problem is now in the UI, instead of “Delay (ms)” it’s displaying “Delay (Ms)”. To a units nerd such as myself, this suggests the delay is specified in megaseconds (about 11.5 days!). Any suggestions?

Are you really sure that you don’t have the capital M in the json? I don’t see any way that it would mess with the strings. Did you maybe mistype it and the correct it, but forgot to upload the zip again? If you had a capital M at some point, but uploaded the new zip, you may want to try to disable and re-enable the plugin. I also noticed during development that the UI behaves quite iffy: You can upload a new version of the plugin and the index file will be properly replaced, but the UI keeps the old pluginUI. You can however get him to load the new pluginUI by rebooting Volumio.