Ropieee Python Script not running

Hi, just wanted to implement a button to reset or shutdown the board. wanted to do this with GPIO 17 and a short python script.
How can I run python on ropieee?

You can’t.

RoPieee is not a regular distro on which you can run custom software; there are other solutions that fit your needs better if you want to do that.


1 Like

The short answer is RoPieee doesn’t support user modifications; use DietPi or some other OS implementation if you want to tinker.

If your need is to shutdown quickly, you can call the button in the GUI via a URL easily enough.

Harry, it is forbidden or it is not recommended to run custom software under Ropieee ?


No it’s certainly not forbidden ( I even can’t :wink: ).

It’s merely pointing out from my side that it is not supported and I want to be clear upfront about it so no one gets disappointed.


1 Like

Thank you for your answer !
So, I can say now that I am running Python under Ropieee :wink:
And also, I have IR remote working which, by the way, would be a nice addition to Ropieee if you decide to implement it !
It would be very useful to can choose a GPIO pin for generic IR sensor and to upload irexec button definition.
I’ve managed to do that, but I have to replace the setting files on every update, otherwise the remote is not detected.
And a last thing, I have OnOff shims on my Roon endpoints with dtoverlay settings in config.txt and even those settings are rewritten on every change or update.

I shwitched back and force - Ropieee and DietPI and liked Ropieee much more. From my perpective it does was it is intented for.
So instead of python I used bash and coded the following pishutown script.

What you have to do:
1.) Connect a GPIO (in my case it is GPIO17 BCM) to a switch / button
2.) create a directory: mkdir /root/pishutdown
3.) create a sh file: vi ./ and past below code to it
4.) create a service file: vi /etc/systemd/system/ropieee-pishutdown.service and past below code to it
5.) chmod 644 /etc/systemd/system/ropieee-pishutdown.service
6.) run the following commands
systemctl daemon-reload
systemctl enable ropieee-pishutdown.service

Next time you should be able to:

  • shutdown your Pi by pressing the button >500ms and <3000ms
  • reboot your Pi by pressing the button >3000ms (3 seconds)
  • below 0.5 seconds nothing will happen. I did this because of my kids :slight_smile:

#RoPieee version for ShutDown GPIO Skript
echo "RoPieee Shutdown script starting…"

# halt by GPIO-17 according BCM
# led by GPIO-xx according BCM

# varriable to store the time when falling edge is recognized
# varriable to store the time when reising edge is recognized
# varrible to store the time differenz between falling and reising edge
# defines the time between shutdown and reboot in miliseconds
# defines the min press time in miiseconds(I used this because of my kinds might just play with the device)

#Defune GPIO 17 as input to receive the trigger from Button
gpio -g mode $halt_gpio in
gpio -g mode $halt_gpio up

#Define GPIO22 as output for driving the LED
gpio -g mode 22 out
gpio -g write 22 1

# wait for GPIO-4 (wiringPi pin 7) falling, or alarm B
echo 'Initialization completed.'

while [ 1 ]; do

  gpio -g wfi $halt_gpio falling
  time_falling=$(date +%s%N)
  gpio -g wfi $halt_gpio rising
  time_reising=$(date +%s%N)
  time_diff=$((($time_reising - $time_falling)/1000000))

  if [ $time_diff -ge $shutdownMinPressTime ] && [ $time_diff -le $shutdownMinMiSecond ]; then
    /sbin/shutdown -h -P now
  elif [ $time_diff -gt $shutdownMinMiSecond ]; then
    #reboot das System
    /sbin/shutdown -r now
    /bin/sleep 0.01
  /bin/sleep 0.5

exit 0


Description=Ropieee PiShutdown

ExecStart=/bin/bash -c '/root/pishutdown/'


Hope this helps. Any feedback is highly recommended.

1 Like

Nice script !
Do you think it could be adapted to replace the python script for ArgonONE case?

sure…my understanding is that you have to change the pin to “4” and add one more state which is double click.

If you let me know what you need I can change the sciprt accordingly