possibility to turn on/off gpio when specific zone is playing.
Hi, is it possible to implement an option to switch on a specific gpio when some zones are playing?
Iam using two KAB9 and it is possible to switch it to mute or standby via relays. An option to delay the output of the zones would be also nice.
It is very helpful for minimizing power,
What output are you running? Depending on the output, it might already be available client side. I assume the gpios are also client side?
For example sendspin has hooks for stream start and stream end which allow you to run your own script.
I believe this is also possible with squeezelite, but I am not sure how this works. @mr-manuel might be able to tell you more about it.
Right now lox-Audioserver has this delay, but it is only for alerts. This should be moved to a per zone one time delay when the zone is off. I will look into this.
i use squeezelite as output. My Hardware is a RPI4. Thanks
i used the MS4H in the past. Its the old custom Musicserver for loxone by Dieter Schmidberger. There was a powermanger installed with wich you could mute the amps.
https://music-server.net/help/MusikServer4Lox.html?Powermanager1.html
Through the command line options of the Squeezelite player you can make yourself a script: https://github.com/ralph-irving/squeezelite/blob/6d571de8fa6dfff23a5a0cbb2c81b402d2c30c31/main.c#L64-L150
Relevant for you:
-S <Power Script> Absolute path to script to launch on power commands from LMS
Here a sample from ChatGPT: https://chatgpt.com/share/69969707-24ac-8000-bf18-714796eaefa1
I have built a configuration interface to map amps to speakers & zones aswell as a very simple "powermanager" replacement: It watches alsa streams and switches on amps via crelay.
If anyone is interested I am happy to share it.
hi, i havent find the time to test the squeezelite solution. Wow, that sounds awesome, yes it would be nice you share it with us.
I will test it asap.
@p4co86 here you go: https://github.com/tobsch/snappy It's not super self explaining as I purely wrote it for myself initially. But give me feedback, please!
Hi, thanks, i have solved it with the Multiio Plugin for Loxberry. Here you can turn on GPIO and use the Aufioplayerstate for switching. I have used a Delay for switching off. Worked very well.
Hi, thanks, i have solved it with the Multiio Plugin for Loxberry. Here you can turn on GPIO and use the Aufioplayerstate for switching. I have used a Delay for switching off. Worked very well.
Will that be enough for you, or do we still need to look for a native powermanagment implementation?
A native solution would be nicer to have all in one, no dependience and so on, but for the first it is ok for me.
A native solution would be nicer to have all in one, no dependience and so on, but for the first it is ok for me.
Power management will be in the next beta. Switching will be experimental and ay require some feedback.
https://github.com/lox-audioserver/lox-audioserver/issues/184#issuecomment-3968966279
That looks fantastic! Could you tell us when the next beta version will be released so we can test it?
Thank you for the new Beta8. i tested the power manager. Iam Using an RPI4 and tried to switch gpio 22 letting everithing on default in the powermanager page and used sysfs. Put GPIO is not switching.
EDIT: I asked chatgpt, i have an offset of 512, so switching GPIO22 means 534. echo 1 > /sys/class/gpio/gpio534/value this command is switching GPIO 22. But with the same settings in the audioserver it doesent work. Any Ideas?
The Audioserver is installed in loxberry wich os is dietpi.
For improvement, it would be also nice to switch a second gpio for the powerunit.
For future things i will use an odroid n2+ would this also work for it?
The basic powermanagement code is in there. It now has a power state and an on and off timeout for setting this state. The on timeout will be used as a delay to start the audio on the zone. Off timeout can be used to trigger a power off.
For the switching I would like to get some feedback on how to implement this, as I don't use this myself.
Hi and thanks again, as i described in my post before. the GPIO und CRelay does not work for me. I have deleted all my containers and config and started from scatch.
For the CRelay ihave checked it and it is listet as /dev/hidraw1 but that also des not work for me. Maybe it has someting to do with privileges. I use this one https://www.amazon.de/dp/B07L12DXWB?ref_=ppx_hzsearch_conn_dt_b_fed_asin_title_1 i have used it in combination with MS4H and the powermanager. As described above it would be also nice to group some zones so that you can switch nother gpio for the PSU.
Thanks
Did it work with MS4H and the powermanager?
Yes it does with crelay, i have not seted it up. I remember the write the serial number in a settings field. I try to get some more infos later and then i will post it.
As described here: https://music-server.net/help/Powermanager1.html
With Crelay a serial number pops up, you have to write it in the settingsfield and choose relay 1 up to 8 and it was switching.
This command works, gpio 22 is switching: echo 1 > /sys/class/gpio/gpio534/value
its an offset of 512, i dont remember, there was a command wich shows gpiochip512, the i asked chatgpt thats how i came to gpio534. But trying it with the powermanager here it does not work either with gpio 22 or 534. as driver i tried sysfs and gpioset. both dont work
here is the log for sysfs:
lox-audioserver-logs-2026-03-02T19-21-25-703Z.txt
and here with gpioset:
lox-audioserver-logs-2026-03-02T19-23-54-589Z.txt
here for crelay:
with privileged: true in the docker-compose.yml gpiochip0 and offset 22 i can switch gpio22 an my rpi4. thanks!
will test it in the evening with odroid n2+ and crelay on both hardwares.
would it be possible to group zones to switch another gpio to switch off the powerunit.
Hi, CRelay is also working, tested on Odroid N2+. I have now switched to an odroid n2+ where the gpio does not work. When i configer it, my Odroid stops working, is not reachable wie web interface or ping, then i have to restart it and undo it.
The command "gpiodetect" gives me "command not found", i have then installed gpiod via "apt install gpiod", after that "gpiodetect" worked. Haven`t found the time to test it again after the installation.
with ghcr.io/lox-audioserver/lox-audioserver:testing-20260309083339 i have tested the groups. I have noticed two thinks:
Take a look at the Switching method.........