PiMoroni On/Off SHIM with LibreELEC

  • Hello all,

    I've recently found LibreElec and have it running on a few Pi 3 Bs here and for the most part it's working absolutely wonderfully.
    I might add that this is my first foray into anything Linux related in about 15 years plus, so it's been fun figuring things out, but occasionally I do have the dumbest of questions, so I apologise in advance for this one!

    I'm looking at installing a PiMoroni On/Off SHIM and found this thread [How to] Pimoroni OnOff SHIM with LibreELEC and all seems relatively straightforward other than the first script.
    What do I save this as (filename and filetype) is it autostart.sh or as it's a python script is it whatever.py ?

    Can I create both of these files directly on the SD card when its in my local machine or is it best to do so via SSH using nano?

    Again, my apologies for the silly questions.

    Andy

  • What do I save this as (filename and filetype) is it autostart.sh or as it's a python script is it whatever.py ?

    Both. Call the Python script from this /storage/.config/autostart.sh:

    Bash
    #!/bin/sh
    
    (
        python /storage/.kodi/userdata/scripts/whatever.py
    ) &

    Create the script folder: mkdir /storage/.kodi/userdata/scripts

    Copy whatever.py into /storage/.kodi/userdata/scripts.

    Make both files executable:
    chmod +x /storage/.config/autostart.sh
    chmod +x /storage/.kodi/userdata/scripts/whatever.py

    Can I create both of these files directly on the SD card when its in my local machine or is it best to do so via SSH using nano?

    Doesn't matter.

  • Thank you very much Da Flex, that's sorted the basic functionality as far as getting it to power off now.

    I was rather hoping I could configure this to set the Pi NOT to boot until the button was pressed on initial power on, but it seems that functionality isn't included in the scripts from the mentioned thread. Would this be something achievable or am I mental for even considering it?

  • I was rather hoping I could configure this to set the Pi NOT to boot until the button was pressed on initial power on...

    I'm not familiar with that SHIM. I assume when you plug in the PSU, it will always boot, no matter what's in the scripts.