Announcement

Collapse
No announcement yet.

Using GPIO to start a streaming URL on an Airplay player

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using GPIO to start a streaming URL on an Airplay player

    Hi everybody,
    I've just finished setting up a Pi Zero W with an IQAudio hat to be used to stream the output of a magnificent Wega Concept 51k stereo system to a Denon AVR via Airplay.
    The PCP running on the zero has the streaming function activated, and everything works nicely.
    The IQAudio hat comes with a pushbutton connected to GPIO27; What I would like to achieve is that pressing this pushbutton does the same as if I had started the playback of the streaming URL.
    Before, I used a script:
    Code:
    #!/bin/sh
    telnet 192.168.50.115 9090 <<EOF #telnet zum PCP-Raspi
    aa%3Aaa%3A89%3Abd%3Ab7%3A51 playlist play http%3A%2F%2F192.168.50.108%3A8000%2Fphono
    aa%3Aaa%3A89%3Abd%3Ab7%3A51  mixer volume 50
    quit
    EOF
    I couldn't find information on how to link the push button to the sh script. I've tried the push button with the gpio-shutdown tweak of PCP. It works fine with the "off" option.
    But how could I send the CLI commands instead?
    Thanks a lot for advice
    Martin
    Last edited by streampunk; 2022-11-25, 11:41.
    PCP (always latest version) on RasPi 3 with PhatDac (player & server)
    PCP on several RasPis 2 +3
    2 Airplay speakers (Sony SA-NS510) integrated via Airplay Bridge Plugin

    #2
    Finally I found my way... even mangaged to assign a double function to the IQAudio push button:

    1. installing sbpd
    2. creating two bash scripts:
    phono.sh: Short press powers up the Denon amp and starts playback of the Zero's streaming URL, via main LMS Raspi (... .135)
    Code:
    #!/bin/sh
    telnet 192.168.50.135 9090 <<EOF
    aa%3Aaa%3Acd%3A84%3A4c%3A59 playlist play http%3A%2F%2F192.168.50.108%3A9100%2FS32_LE%2F44100%2F2%2FM
    aa%3Aaa%3Acd%3A84%3A4c%3A59  mixer volume 50
    quit
    EOF
    shutdown.sh: Long press starts shutdown
    Code:
    #!/bin/sh
    sudo /sbin/poweroff
    exit 0.
    3. putting
    Code:
    sbpd b,27,SCRIPT:/home/tc/phono.sh,2,0,SCRIPT:/home/tc/shutdown.sh,1000
    as User command #3 in PCP.

    Seems to work nicely, even if I'm sure that there are more elegant ways to achieve this goal
    Now I'll try to connect another push button to GPIO3 - GND. As far as I understand, this should power up the zero from standby, adding
    Code:
    dtoverlay=gpio-shutdown,gpio_pin=3, active_low=1,gpio_pull=up
    to config.txt
    Regards
    Martin
    PCP (always latest version) on RasPi 3 with PhatDac (player & server)
    PCP on several RasPis 2 +3
    2 Airplay speakers (Sony SA-NS510) integrated via Airplay Bridge Plugin

    Comment

    Working...
    X