Disable lights with pushbutton?

  • Hi.

    I'm wondering if there's a way to disable the LED strip using a simple pushbutton connected to the GPIO?
    I'm waiting for the LED strip currently, going to set up a HDMI-input ambilight with the standard raspberry-grabber-hdmi splitter-hdmi converter combination.
    I saw there are plugins for Kodi etc for this, but no standalone options.

  • I'm very new to the raspberry and not a coder at all (much better at messing with the hardware than the software).. Do you have an example? I tried digging around some already, but all the tutorials seem to require decent coding knowledge and only give parts of the needed info, not a "from scratch" approach.

  • things to search for: find out how to trigger a script with pushing a button on the gpio pins and then trigger 2 scripts... for example set all leds to black with hyperion-remote -c black and the second would be clear the message with hyperion-remote --clearall

  • if you're a smart phone user, your could create and save 2 ssh commands:

    Code
    sudo systemctl start hyperion.service

    and

    Code
    sudo systemctl stop hyperion.service


    Im on iOS and use the native 'shortcuts' app to do just this, i then have these SSH scripts set as two widgets on my smartphone that are quick to access.

  • Ok, I managed to hack together a solution.

    This goes in /usr/local/bin/ as hyper-switch.py.
    sudo chmod +x /usr/local/bin/hyper-switch.py

    This goes in /etc/init.d/ as hyper-switch.sh
    sudo chmod +x /etc/init.d/hyper-switch.sh

    Finally run
    sudo update-rc.d hyper-switch.sh defaults

    Reboot.

    Connect a pushbutton between pin 5 (GPIO3) and GND.
    Pressing the button will toggle between setting the LED strip to all black and resuming normal operation.

    The code and info is mostly bits and pieces I found online and adjusted to fit my needs.. it seems to work fine so far.

  • if you're a smart phone user, your could create and save 2 ssh commands:

    Code
    sudo systemctl start hyperion.service

    and

    Code
    sudo systemctl stop hyperion.service


    Im on iOS and use the native 'shortcuts' app to do just this, i then have these SSH scripts set as two widgets on my smartphone that are quick to access.

    Hello,

    I need some similar to coreelec/libreelec, it is possible?

    Thanks

  • Hello,

    I need some similar to coreelec/libreelec, it is possible?

    Thanks

    For all who are still searching for the command or just clicked on this thread:

    To start hyperionservice just take the command from your autostart.sh in /storage/.config/
    In my case its:

    Code
    /storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /storage/logfiles/hyperion.log 2>&1 &

    To stop the hyperion service on Libreelec take this command:

    Code
    killall hyperiond

    This is how i do it. My personally next steps are:
    - write a script that kills the hyperion service and changes the resolution to 4k
    - write a scirpt that changes the resolution to 1080p and starts the hyperion service (because the RPI4 is not ready for Hyperion+4k yet)

    extend with a custom static color for backlight while hyperion (grabber) service is turned off.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!