RPi4 GPIO using in LibreELEC

  • Wht don't you try gpiozero Button..more flexible....you can add short press reboot,long press shutdown etc

    Hello #Mario77... It seems that you are good at Linux coding. I am not that good at Linux/LE, and i have make few changes through SSH, so i know what it is ans so. Today i have Generic AMD/Intel/NVIDIA (x86_64) installed on a PC, and it is connected to a UPS that support it at a power break. My idea was to make a script or so like: "if LAN/ethernet goes down start shutdown.sh" or something like that. Thought there was an "power manager addon" that has a function for my idea, but can not find any. Best regards from Thore in Sweden

  • Hello #Mario77... It seems that you are good at Linux coding. I am not that good at Linux/LE, and i have make few changes through SSH, so i know what it is ans so. Today i have Generic AMD/Intel/NVIDIA (x86_64) installed on a PC, and it is connected to a UPS that support it at a power break. My idea was to make a script or so like: "if LAN/ethernet goes down start shutdown.sh" or something like that. Thought there was an "power manager addon" that has a function for my idea, but can not find any. Best regards from Thore in Sweden

    Hi,sorry can't help you much with that..I mostly play with my Rpi but have no idea about Generic AMD/Intel/NVIDIA (x86_64)

  • Mario77 : How do I do that, where do i find an exact discription to do that?

    easy enough


    Will look something like this

    Taken from here just changed few bits to work with LE..

    You ll need to install Rpi Tools addon for this to work..

    Edited once, last by Mario77: Merged a post created by Mario77 into this post. ().

  • Mario77 : downloaded the zip and tried to install it, but unable to.

    RPI tools is a console only addon, don't know how to use that.

  • Mario77 : downloaded the zip and tried to install it, but unable to.

    Which zip?

    I didn't mean you just download that zip and install it...

    but on previous post I made you a small modified script that will work..

    You ll need to create a system.d service that start the script or use autostart.sh to start it..

    This you can play around how you want ex changing the when released function to something like

    Code
    def rls():
            global held_for
            if (held_for > 3.0):
                    check_call(['/sbin/poweroff'])
            else:
                    check_call(['/sbin/reboot'])

    this will exec shutdown if held more then 3 seconds or reboot if less...

    You got plenty of options to playwith...ex my switch has an led built into it and it can blink or fade or whatever you want it to do but for that you ll need an npn transistor.

  • FYI RPI Tools add-on may not work anymore on some LE releases / builds.

    I don't know if it could be your case as well or not.

  • This is much to deep water for me, if there is a typo, i won't regognize that and drowning would be likely. For instance: They are counting the GPIO headers in my option the wrong way arround. i would say that there button is connected on pin 13 and 14.

    But I am so in experienced, that my pin 5 and 6 probably are 35 and 36

  • But I am so in experienced, that my pin 5 and 6 probably are 35 and 36

    Pin 5 is GPIO 03, pin 6 is Ground (same height, but the other column).


    You'll find diagrams on the internet about pin vs. GPIO numbering.

  • This is much to deep water for me, if there is a typo, i won't regognize that and drowning would be likely. For instance: They are counting the GPIO headers in my option the wrong way arround. i would say that there button is connected on pin 13 and 14.

    But I am so in experienced, that my pin 5 and 6 probably are 35 and 36

    I changed that as your wiring if you look on my post above

    use_button=3


    as Da Flex pointed out Pin 5 is GPIO 03 as gpiozero uses gpio numbering..


    So you keep using pin 5 (+) and 6 (-)

    Edited once, last by Mario77: Merged a post created by Mario77 into this post. ().