@spyking: Thanks for the amazing work The nomenclature looks good to me, also the UI design. At first I thought about merging the latching with the inverter flag into a drop down, like: operation mode: Normal, inverted, latching. But when looking at your solution I realised that you might also want to have inverted latching, so I think it makes more sense to make it two separate switches. I’m just not sure what you mean with the dual latching? Sending two pulses?
Already saw your PR, will look into it in the next few days and add the german translation
You can solder together a pretty simple circuit that takes the output of the GPIO of the RPi 3 and drives a 12V output to the Amplifier Jack. I guess a MOSFET should suffice, if you really want to have it decoupled you may want to use an opto-isolator and an additional transistor.
I initially wanted to have an “Normally Open, Normally Closed, Latching” drop down - but then I thought it became unnecessarily verbose and meh, so left it at this. When you toggle “Latching” - you get the on pulse and off pulse setting, keeping it simple.
Sooo… what next? Multi GPIOs? I do have a pre, and power amp…
Is this really a thing with the two GPIOs? I usually prefer hardwired solutions for this kind of thing, whenever it’s easily possible, gives more reliability and doesn’t unnecessarily populate the GPIOs, but I get the impression that I’m the only one with this idea here
Btw, I added the PR for the german language strings. Volumio was faster to integrate your PR than I was with adding the strings
Is there a way to get the version of this plugin with relay pulse already now or do I have to wait for the official release in the plugin manager of Volumio?
Yes - but I am unsure how the pluginmanager gets the node_modules which aren’t included in the git repo.
But you can try with the attached zip ampswitch.zip (1.05 MB)
I just ran into this error while trying to uninstall the plugin - Any ideas?
Mar 01 18:14:21 volumio volumio[23345]: info: Starting Uninstall of plugin miscellanea - ampswitch
Mar 01 18:14:21 volumio volumio[23345]: info: Uninstalling plugin ampswitch
Mar 01 18:14:21 volumio volumio[23345]: info: PLUGIN STOP: ampswitch
Mar 01 18:14:21 volumio volumio[23345]: info: [ASDebug] Port: 14
Mar 01 18:14:21 volumio volumio[23345]: info: [ASDebug] Inverted: false
Mar 01 18:14:21 volumio volumio[23345]: info: [ASDebug] Delay: 720
Mar 01 18:14:21 volumio volumio[23345]: fs.js:610
Mar 01 18:14:21 volumio volumio[23345]: return binding.close(fd);
Mar 01 18:14:21 volumio volumio[23345]: ^
Mar 01 18:14:21 volumio volumio[23345]: Error: EBADF: bad file descriptor, close
Mar 01 18:14:21 volumio volumio[23345]: at Error (native)
Mar 01 18:14:21 volumio volumio[23345]: at Object.fs.closeSync (fs.js:610:18)
Mar 01 18:14:21 volumio volumio[23345]: at Object.<anonymous> (/volumio/node_modules/graceful-fs/graceful-fs.js:51:27)
Mar 01 18:14:21 volumio volumio[23345]: at Object.<anonymous> (/data/plugins/miscellanea/ampswitch/node_modules/graceful-fs/graceful-fs.js:51:27)
Mar 01 18:14:21 volumio volumio[23345]: at Object.closeSync (/data/plugins/music_service/volspotconnect2/node_modules/graceful-fs/graceful-fs.js:51:27)
Mar 01 18:14:21 volumio volumio[23345]: at Gpio.unexport (/data/plugins/miscellanea/ampswitch/node_modules/onoff/onoff.js:354:6)
Mar 01 18:14:21 volumio volumio[23345]: at AmpSwitchController.freeGPIO (/data/plugins/miscellanea/ampswitch/index.js:230:19)
Mar 01 18:14:21 volumio volumio[23345]: at AmpSwitchController.onStop (/data/plugins/miscellanea/ampswitch/index.js:84:10)
Mar 01 18:14:21 volumio volumio[23345]: at PluginManager.stopPlugin (/volumio/app/pluginmanager.js:292:27)
Mar 01 18:14:21 volumio volumio[23345]: at PluginManager.unInstallPlugin (/volumio/app/pluginmanager.js:1149:8)
Mar 01 18:14:21 volumio volumio[23345]: at CoreCommandRouter.unInstallPlugin (/volumio/app/index.js:1343:21)
Mar 01 18:14:21 volumio volumio[23345]: at Socket.<anonymous> (/volumio/app/plugins/user_interface/websocket/index.js:1094:55)
Mar 01 18:14:21 volumio volumio[23345]: at emitTwo (events.js:106:13)
Mar 01 18:14:21 volumio volumio[23345]: at Socket.emit (events.js:191:7)
Mar 01 18:14:21 volumio volumio[23345]: at /volumio/node_modules/socket.io/lib/socket.js:503:12
Mar 01 18:14:21 volumio volumio[23345]: at _combinedTickCallback (internal/process/next_tick.js:73:7)
Mar 01 18:14:21 volumio volumio[23345]: at process._tickCallback (internal/process/next_tick.js:104:9)
Mar 01 18:14:21 volumio volumio-remote-updater[574]: [2018-03-01 18:14:21] [error] handle_read_frame error: websocketpp.transport:7 (End of File)
Mar 01 18:14:21 volumio volumio-remote-updater[574]: [2018-03-01 18:14:21] [disconnect] Disconnect close local:[1006,End of File] remote:[1006]
Mar 01 18:14:21 volumio systemd[1]: volumio.service: main process exited, code=exited, status=1/FAILURE
Mar 01 18:14:21 volumio systemd[1]: Unit volumio.service entered failed state.
@spyking: At the time of writing the initial version of the plugin I ran into this problem once or twice, but, at least to me, it was not reproducible. From what I get from the log it runs into a problem when stopping the plugin and returning its privileges on the GPIO. I’m unsure whether this happens when
a) Plugin is installed and before activation deinstalled again, i.e. it has not been started and thus never claimed the default GPIO
b) a GPIO is being claimed/released that is still allocated by something else
c) some hiccup occurs in the underlying node modules, e.g. onoff
I always wanted to make it a bit more robust using some error handling like
try ... catch ....
, but I have not run into this problem again and no one else reported it until now, so motivation was rather low
Maybe you can try to fiddle around with it a bit to verify that one or none of the above points is actually the case, I’m currently pretty busy and just sporadically find the time to look in here.
Hi, it would look like the volumio user doesn’t have access to the GPIO group (which might be needed ala Raspberry pi), you might have to manually add it,
groupadd gpio
usermod -a -G gpio volumio
You should then see something like
gpio:x:999:volumio
from
cat /etc/group
But countercheck with someone with a pine64 if this is indeed needed.
@michelangelo but that will make a version that is not compatible for people who haven’t upgraded yet.
also - my last PR’s were merged - but no package made it to the gh-pages branch! But I see that this the job of volumio plugin publish
Awesome job man. This plugin I almost what I need
I have two sources, one is TV and the second one pi. Both of them are connected to the same amp.
My problem now is when I stop the music in volumio, my amp turns off and I can watch TV but without sound.
I have played with your plugin and I understand how the plugin works. I would change it to turn on/off the amp with a single switch.
My question is “can somebody give me an example of changing UI”.
I would like to put a button and with that button I would like to open a new page.
In that new page on the top I would put On/Off switch to control the amp.
Here is an example where I would like to put the button for opening the new page.
If that is to complicated, can somebody suggest me something else to try out?