System command to detect GPIO status

What is the problem?

I'm trying to write a "System Command" to detect the status of a GPIO pin but I'm struggling. The command will go in the sensing section of PSU Control. This status will tell OctoPrint if the power to the printer is on or off based upon the voltage on a GPIO pin. Unfortunately I have not come across system commands before and my research has not helped me.

What did you already try to solve it?

I've tried all the standard settings in PSU control and it's currently all in reverse of what I want and the 'invert' settings are not working. I'm let to believe that using "System Command" is more reliable. My research suggested I try
gpio -g read 26
I was expecting this to output either a 0 or 1 and PSU Control would interpret this as on or off - but this doesn't work.

help here would be very very much appreciated!

error message?
Maybe you oversee to activate and setup the pin on systemlevel?
Hint: on Pi system prompt: gpio -h

Thanks for your help

I don't get any error messages, it just doesn't work. Looking around the internet and lots of people have had lots of different problems getting the PSU plugin to function correctly and I have tried all the fixes I can find. The relay works OK and I can set it to either turn on during boot or remain off during boot. The problem is that I can't get the "sense" to work as I need it to and the "invert" tick box (when ticked) just stops the relay from working. My research so far has suggested that the "GPIO" and "Internal" options for the sense can be unreliable and that using the "System command" option is better however I have no idea what that means and there is nothing in the add-on documentation.

To be honest I am not sure what the problem actually is but as part of the fault checking process or as a work-around, I was thinking of using the "system command" option to sense the status of the pin but I have no idea what to enter and I'm struggling to find any documentation on it.

Ideally, the settings would be as below but whenever the "invert" boxes oppose each other it does not work. Both not ticked or both ticked and it works fine:


sorry, but maybe it would be a not so bad idea to become more familar with Linux and Pi OS.
There is a lot of information at the internet. Unfortunately almost 50% is trash. Be carful on following "good tips", if you not realy know, what you are doing.
If you are working normally with Windoofs, it might be a good choice to switch Pi/SSH on and use Putty and WinSCP with your PC to administrate your Pi.
All other might be German: stochern im Nebel.
Try to get access to log files; to the OctoPrint ones which you can access by OctoPrint Web interface and to the Pi logs which you can find at /var/log/ on the Pi and read with a normal text editor like Notepad++. Most important file: syslog. You can easily access the Pi logs with SSL / WinSCP, using your PC.

Yes I completely agree. I am trying to but it's a very steep learning curve and this has got me completely stuck.

All my components seem to work but when the system boots up, either the relay is engaged but OctoPrint thinks the printer is off, or the relay is not engaged but OctoPrint thinks the printer is off.
I just need OctoPrint to boot-up and immediately think that the power is on. I don't care what state the relay is in. This makes me think that adding the correct thing into that Sensing "system command" box will solve the problem but I can't even find what "system command" actually means nevermind work out what to type in there.

I have no idea if the log will help:
octoprint.log (986.3 KB)