What is the problem?
I am trying to get a relay to close when Octoprint shuts down. It worked in the past on a headless Pi, but now it doesn't seem to work.
What did you already try to solve it?
Replaced pi with another Pi 4B (8GB), and entered GPIO commands manually in the terminal window. Didn't help.
Have you tried running in safe mode?
no-problem seems to be outside Octoprint. Don't know how to run Octoprint in safe mode.
Did running in safe mode solve the problem?
Didn't run is safe mode.
Systeminfo Bundle
You can download this in OctoPrint's System Information dialog ... no bundle, no support!)
Didn't do this. Don't know how.
Additional information about your setup
What kind of hardware precisely, OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible
Octoprint Ver 1.9.3 on a 8GB Pi4B Prusa MK4 printer with the following plugins:
Automatic Shutdown
Bed Visualizer
Classic Webcam
Dashboard
Enclosure Plugin
Firmware Check
GPIO Shutdown
PrintTimeGenius Plugin
Printer Dialogs
Printer Notifications
Virtual Printer
In any case, Octoprint runs fine.
In the server settings, I have the following for Shutdown system: /home/pi/sdown.sh
In the sdown.sh file, located in the pi@octopi directory, I have the following commands:
disconnect
gpio -g mode 27 out
gpio -g write 27 1
sudo shutdown -h now
This works, and shuts down the Pi, except that nothing is written to GPIO pin 27 (it still remains at 0). I tried manually entering the GPIO commands manually into the terminal window, and got no error message, but GPIO pin 27 never went high. GPIO pin 27 closes a relay that pulls power to the pi and the printer. I tried different GPIO pins, but nothing seems to work.
The GPIO pins within the Octoprint plugins seem to work fine, and I have a pushbutton and LED configured in the GPIO shutdown plugin, and they work fine.
This used to work fine when I ran Octoprint in a headless Pi (no display). When I rebuilt the Pi with the 7" Pi Touchscreen display, the GPIO commands don't seem to work anymore. I want to use the display to bring up the Chromium browser so I can control Octoprint from the Pi instead of having to log into Octoprint from another machine. This seems to work. The problem is the GPIO setting pin 27 to a 1 doesn't work.
I am a newbe to Linux.
I can't figure out why the GPIO commands don't set pin 27 to high.
I am using a darlington on the output of pin 27 to drive the relay, so there is very little current draw on pin 27.
Please help.
Thanks in advance.