Script for Raspberry Nespi case+??? (SafeShutdown, SafeReset, and LED)

  • NisteR

    Changed the title of the thread from “Script for Nespi case+ (SafeShutdown, SafeReset, and LED)” to “Script for Raspberry Nespi case+??? (SafeShutdown, SafeReset, and LED)”.
  • Insufficient information : What are you asking? What are you trying to do.Please provide more information. Hardware, version of LE etc

  • Purpose of this script is to make shutdown & reboot (+LED) buttons on RetroFlag NesPi Plus case to work on Raspberry Pi LibreELEC.


    Here's script for RetroFlag NesPi+ case which I modified for my needs from recalbox_SafeShutdown.py. No need to download or install anything from linked github page. Save the code I shared for example as "nespi_shutdown.py" and copy it to your LibreELEC sd card.


    On LibreELEC install following add-ons:

    • LibreELEC repository: rpi-tools (I'm not sure about exact addon name, might have been also RPi.GPIO or something)
    • KODI add-on repository: Kodi Callbacks

    From "Kodi Callbacks" settings set "nespi_shutdown.py" to run on KODI start. There's also other ways to run scripts on Kodi start but I have used this add-on because of my limited skills :)


    Also "Safe ShutDown" switch inside NesPi+ case needs to be turned ON.


    I don't have knowledge to say if my modified script is 100% correct but power button, reset button & LED seem to work correct. Although LED doesn't blink correctly for a short time after reboot button is pushed (maybe because LibreELEC reboots much faster than Recalbox). If there's any improvements to be done please share :)


    Edited 3 times, last by jleppa ().

  • Looks really clear to me : Nespicase+ comes with secure power+reset button and need script

    Your solution is working for me but not the led

  • kinda painful to configure callbacks, here's a working tip using SSH and not kodi (so the raspberry should respond too when kodi crash)


    Just connect via SSH and launch this Lakka script : GitHub - marcelonovaes/lakka_nespi_power: Lakka 2.1 + NESPi CASE + Shutdown buttons


    The only thing different is the root password according to this page, default is libreelec : Accessing LibreELEC [LibreELEC.wiki]

    Also, you have to activate SSH on libreelec settings, that's not said, you just switch the button without reboot


    Tip was found on this post : Shutdown script for the snespi case


    it's very unfortunate that this small script isn't offered directly in libreelec, you know a simple addon called "Nespicase+ soft shutdown buttons" ....

  • If someone could point me in the right direction of creating a add-on I'm more than happy to spend some time on this.


    Previously I used other scripts but I had problems with both in the end, one being after a period of time it wouldn't reset or Shutdown and I would have to pull the plug and the other script I found the red led would always flash instead of staying on.


    So in the end I sat down did my research and created my own script.


    I wrote a script to work with gpio zero, installing raspberry pi tools from the LibreELEC repo will enable gpio zero.


    After that I copied of my scripts and created a autostart.sh file in the .config folder and everything works perfect.


    My script also sends the correct commands to shut down libreelec correctly "kodi-send --action"shutdown"


    This shuts down the exact same way it would if you select power off from the power menu of Kodi.


    I don't feel "shutdown -h now was doing the job properly as it shutdown almost instantly making me feel metadata etc wasn't being saved.


    So if I could create a add-on that had the raspberry pi tools as a dependency and then installed my scripts that would be perfect.


    The problem is I wouldn't know where to start with this lol