Amplifier Switch Plugin

Does the Plugin support Relay pulses?

Not yet, but there seems to be a growing interest. I’ll try to find some time at the end of the year to implement this.

Many thanks for this great addon!

For those impatiently looking for relay pulses, I created a version which only does this (as I’m only suited with limited programming skills). Feel free to check it out and modify yours manually: github.com/hannes386/volumio-pl … h/index.js (the modifications only happened in the lines 168-171 and 177-181).

Please only manually interfere with the code (and the well established plugin infrastructure) if you know what you’re doing.

By the way, has someone of you managed to add support for shairport? I would highly appreciate some hints. Thanks!

Does the plugin recognizes when I play something via Airplay oder Spotify Connect?
When playing songs directly with volumio, mpd is beeing used, right? In this case I get informed with an “mpd remote” on my smart home system. But when I stream the music via spotify and the volspotconnect plugin, mpd won’t be used. Airplay I did’t tried right now.

Thanks for your work hannes, gives me some time until after christmas to properly implement this with the UI

The plugin is constructed in such a way that it interfaces volumio’s own signals, rather than specific signals of music clients, such as mpd. As long as a music source implements the correct signal, AmpSwitch will pick it up and switch, regardless of the source. By Issue #83 of balbuze/volumio-plugins the Spotify plugin should be implementing these signals. For Airplay, it works for me.

Hi guys

Sorry to hijack this thread. I installed AmpSwitch on my Rpi with Pi-Dac+ and Pi-AMP and I couldn’t get it to work properly. Then it muted my amp and I couldn’t get it to come back on again no matter what I tried - rebooting etc etc.

I tried to uninstall the ampswitch plugin and it wont let me switch off or uninstall (seems to just restart Volumio).

Can anyone help or tell me how to uninstall this plug-in using SSH?

Thanks

Dominic

(1)

Can you please explain which amp you are using? A short google of “Pi-Amp” didn’t give me any meaningful results. Most helpful would be a link to Pin-configuration of the HAT.

(2)

If it mutes your amp, it might be that the amp logic is inverted, i.e. for some Amps, you need a PWR-Pin, for some you have a Mute-Pin. IF Amp-Switch is now turning the Pin high when music plays and that mutes your amp… well… not much to listen to.

(3)

Please open a dedicated issue on Github with a detailed explanation of the behaviour and when it occurs. Please attach a complete log-file, created via sudo journalctl -p7 >journalctl-p7.txt .

After finishing (3) you can navigate to the plugin folder via ssh and delete the amp-switch subfolder. The folder is located under plugins/miscellanea. After deleting the folder, you should reboot and then the plugin should be gone.

  1. It’s IQaudio Pi-Amp - see here: iqaudio.co.uk/hats/25-pi-amp-0712411999698.html
  2. Not sure I quite understand that but I’d be interested to hear your thoughts based on the info in 1.
  3. Will do.
  4. Done.

Thanks and looking forward to your reply about 1 and 2. Thanks in advance.

Dominic

Hi Fightclub

I found this:

Does this help?

Dominic

Thanks Dominic for your searching. Let me first shed some light on the intention behind the AmpSwitch plugin to clarify (2).
AmpSwitch was originally designed for external, digital amplifier boards. In order to save energy, the amplifiers power would be driven by a transistor/mosfet that allows to switch the amp on/off. To do so, the amp switch plugin listens to the internal messages being passed around in volumio and triggers a GPIO pin of the raspberry to power the amp via transistor/mosfet. Apart from that Ampswitch can also be used for amps that have a mute input. But there it depends on the chip whether mute powers off the chip or not, it might not have any effect, but that might depend from board to board. You could also use Ampswitch for boards with mute that are very sensitive to static noise or an unconnected aux in.
Based on this intention, the standard behaviour of AmpSwitch is: Play -> Output on Pin is HIGH, Pause/Stop -> Output on Pin is LOW.
Since for mute the logic is usually other way around, the settings allow to set the output to inverted: Play -> Output on Pin is LOW, Pause/Stop -> Output on Pin is HIGH.
This means that a wrong configuration, e.g. non-inverted ampswitch and an output connected to mute will give no sound: When song is paused, the output is low, amp is unmuted and when you press play, output is high and the amp is muted. This is the behaviour is was referring to in (2).

Did you choose the correct GPIO (22) in the config of AmpSwitch? Did you set it to inverted or non-inverted?

First of all, thanks for this plugin!
This is exactly what i need!
i already read hannes post regarding his modded relay-version, but i’m a noob in programming. thus, i don’t understand how to implement my relay.

right now, i’m using my iphone and the app simplessh to remotely switch my amp.
i’m using these commands to trigger my relay which turns my amp on or off:

gpio export 4 low sleep 0.5 gpio export 4 high
will there be a chance, that i can do this with your plugin?

Hey Lokus,

thanks for your interest in the plugin. My suggestion: Install the plugin as served via volumio plugin section. After installation is successful and while plugin is deactivated, do the following:

  • ssh into volumio
  • go to the plugin folder and find ampswitch’s index.js
  • overwrite the original index.js with hannes’ version of the index.js from his GitHub
    (- optional: change the delay in lines 171 and 180 of hannes’ index.js from 1000 to 500)
  • reboot volumio
  • activate the plugin
  • select GPIO 4 in the settings of AmpSwitch
  • select inverted to send and low and then a high signal
  • save settings

This should then do exactly what you are doing right now via ssh

1 Like

Juhu! Danke! (Great! Thanks! :smiley: )
Will try it in the next days and post my feedback.

Kein Problem! :slight_smile:

Hope to implement this feature in the official plugin soon. The functionality itself is, as hannes has shown, is done in less than a minute, but working on the UI always bugs me, I somehow always manage to break the XML :unamused:

Geil! Funktioniert!! (Wooohooo! It works!)

Thanks a lot! Great plugin!

EDIT: But unfortunately it doesn’t work when i stream with spotify connect :frowning:
EDIT2: At least i’ve got a workaround for me. I’m using Home Assistant on another RPi Zero W to control some switches and also Volumio. With an automation i can send my relay command and switch my amp, when spotify is streaming.

1 Like

That’s strange, we had this before and according to github.com/balbuze/volumio-plugins/issues/83 this should have been solved.

Hmm, actually it doesn’t work for me when streaming with spotify connect. Just tested it again.
Playling a local song or a song with the “normal” spotify plugin works flawless.

btw, when i play a song with spotify connect, the volumio mediacontrols don’t change. the icon “play” doesn’t change to “pause”. i don’t know if this behaviour is normal.

EDIT: i just found out that your plugin isn’t working with volspotconnect2, but with volspotconnect (there are two different versions)!

Okay, since I’m not using spotify I have no idea about those plugins. But bottomline: If a media plugin, i.e. a plugin that serves an audio stream to volumio, regardless of the source, does not properly implement Volumio’s policy of sending websocket events for play/pause/stop, etc. then the plugin will not trigger AmpSwitch. This however is not a flaw of AmpSwitch, but of the plugin that does not communicate it’s status. I therefore suggest you visit the author’s GitHub and report an issue about this.

Since Spotify Connect uses a separate daemon that is not connected to the mpd of Volumio, it doesn’t really communicate to well to Volumio, which leads to issues such as this. With volspotconnect I got it talking to Volumio, and this pluging should work fine, but volsptoconnect2 uses an entirely different daemon. The first steps are in place, and hopefully soon we should have volspotconnect2 communicating to Volumio soon! :slight_smile:

@Fightclub,
I had some time today, implemented relay pulses as well, but wanted to check with you about the UI naming nomenclature before submitting a PR.
I added a simple toggle, that when enabled gives a ‘pulse duration’ setting

changes here

Oh, I need some help with the DE translation, mein deutsch is ok, aber mein technisches Deutsch is nicht so gut!
What would the ideal translation of pulse width/duration?

Technically, since these are all just different relay types, would you prefer a drop down to select the relay type?
That way we can have : Normal, Latching, Dual_Latching… etc

Cheers!

Hi,
I have a power amplifier in my setup, which can be remotely switched on/off via 6.35 mm jack connector. When there is active voltage of 12 V, it is on, otherwise it is off. It is kinda industry standard, applied by many traditional electronic devices manufacturers. Does anybody know about piece of hardware, which I could connect to Rpi 3 to switch the amplifier on/off using Volumio and Amplifier Switch Plugin?