Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shairport-sync and GPIO permissions #775

Closed
ormej01 opened this issue Nov 24, 2018 · 5 comments
Closed

shairport-sync and GPIO permissions #775

ormej01 opened this issue Nov 24, 2018 · 5 comments

Comments

@ormej01
Copy link

ormej01 commented Nov 24, 2018

Hi, I'm running Shareport-Sync on a raspberry pi zero W with an IQAudio Pi Dac zero, and it has been working well for several months. Runs much cooler than the Apple Airport Express, and seems to be more reliable. It seems to use around 700mW.

I have now added code to turn on a solid-state relay with a GPIO pin using the 'run_this_before_play_begins' and 'run_this_after_play_ends' variables. The only problem is that the 'shareport-sync' user does not have sufficient permissions to access the GPIO pins, unless it is added to the root user group.

This does not seem good for security. What would be best practice to make this work? Shareport-sync user able to run a python program controlling GPIO pins as well as being an airplay device?

Also using the above variables causes the Stereo amp to be turned on when music starts playing, and also turns off if the music is paused. Ideally, the amp would turn on when a successful connection to the airplayer has been achieved, and off when the connection is dropped. Is there a way to do this? Many thanks.

John O

@mikebrady
Copy link
Owner

Thanks for the post. I am not too familiar with using the GPIO ports, TBH, so can't really advise. Regarding pauses, the scripts are executed in response to messages coming from the music source, e.g. iTunes, and no distinction is made between a pause and a true stop, so unfortunately Shairport Sync can't distinguish between them. I think you'd have to implement some separate scheme relying on timeouts, say not switching off the amplifier for a minute, and staying on, of courses, if a play command was received before the minute was up.

@ThisIsQasim
Copy link

You can run sudo usermod -aG gpio shairport-sync and then restart your Pi. This should let you use the GPIO utility with shairport-sync user.

@giggywithit
Copy link

IQaudio uses gpio 22 to mute and unmute the DAC itself during various operations. Read the IQaudio documentation and get back in touch if you'd like to know how I use it with my amp.. I've also created a UPS power supply if you're interested that performs all the functionality that you appear interested in.. have a look..

https://www.youtube.com/channel/UCQmW3n6psbRsKbLeA2NHeuQ

@tehfink
Copy link

tehfink commented Apr 22, 2020

This worked for me with a pi zero & relay:
apt-get install wiringpi

and:

sessioncontrol =
{
        run_this_before_play_begins = "/usr/bin/gpio mode 29 out"
        run_this_after_play_ends = "/usr/bin/gpio mode 29 in"
…

@github-actions
Copy link

This issue has been inactive for 60 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants