GPIO not working, indicates "OK" (yellow)

The failing connection is set to a motion detector where the detector output is lo unless active. The node is programmed with a pull-up.

I did as you suggest and the same problem with the GPIO nodes exists.

Interestingly the problem with setting volume has gone away and the command works fine now.

Could you select just the Garage motion detector node and export and paste it here please, I will see if the same config on a system here gives problems.

Which OS image did you use?

I don't see the point in sending the function node Colin as it is working perfectly. I tested this early on with the "Test" & "Simulate Motion" inject nodes you see in the gif above (which simply sends a 1 (motion) and then 6 secs later a 0 (reset). The dashboard shows the changes as expected both to active then passive.

Here are versions:

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux" v 12.9
Linux 6.6.74+rpt-rpi-v8 aarch64

Image used was the Bookworm 64bit from Debian for rPi4 (writes the boot image direct to the SD card).

EDIT: I always export a copy of each of my tabs as I make changes to them (for individual backup). I was able to go back and grab a previous rPi3 exact copy of the code (flow) for this tab, deleting the current in the rPi4 and importing this older version. It does exactly what the current one is doing. (This motion detector tab is simple and has not seen any change in years so I can confirm it as perfectly operating for a long time previous to this).

Not the function node, the GPIO node, labelled Garage Motion Detector. The one that is not working. I want to make sure I configure mine exactly as yours.

FYI. I set all 3 to node.warn when there is motion, triggered the detectors and 2 of them worked properly.

3/3/2025, 5:11:17 PMnode: Monitor Basement motionfunction : (warn)

"Motion: Basement"

3/3/2025, 5:11:40 PMnode: Monitor Mainfloor motionfunction : (warn)

"Motion: Mainfloor"

3/3/2025, 5:12:03 PMnode: Monitor Mainfloor motionfunction : (warn)

"Motion: Mainfloor"

EDIT: Is it possible to check under what conditions that GPIO nde woould produce a yellow ":OK"?

EDIT2: Other nodes are showing the same issue. I have an input that monitors commercial hydro (AC) that is also yellow "OK" and not working. FWIW it is GPIO25 : Header Pin 22 So 10 of 12 are fine, just these 2.

I am still running in local mode.

I don't see the "OK" status for an extended period on any pin, neither Bookworm nor Bullseye.

There is something odd going on with this node though:

I see several such pins where the "radio button" in the config does not get saved / populated, eg pin 31/GPIO 6

In the pic below, these pins are marked with an asterisk comment.

The pins affected by this are the same for me on Bullseye and Bookworm

I've restarted with node-red-start and interestingly GPIO25 : Header Pin 22 which was previously yellow "OK" is now showing proper green "1" however it SHOULD be showing green "0" (input is currently low). It is not responding to input changes when I remove AC (this is my commercial AC monitor, which is a N/O relay that is closed with AC, open when AC is not avail, a very simple input).

I found an unused pin that is likewise affected GPIO 04 (7)

Also, the problem with amixer set Master 65% volume command via exec node is not working again. It worked fine when I ran local node-red.

I can also see the issue that the pin is often not shown in the dialog. I have raised an issue. It is very odd that this has only recently started to be seen, as I can also see it on old versions of NR and old versions of the OS. The node itself has not been updated for two years. I think the problem with the nodes not working (as opposed to not showing the pin) is probably separate, and may be related to Bookworm, where I believe there have been changes in the OS with the way the GPIO works.

I deleted my flow (which was just every available pin set as an input) because running it caused my zero 2 pi to hang.
Not sure why interrogating the gpio would consume so much system resources.

That also needs investigating, was there anything in the node-red log. It is a shame you deleted it. If you have not deployed again yet then it should still be available in .flows.json.backup

You are right about the resource usage being high. On an old Pi Zero I am seeing the python nrgpio script consuming about 3% of the processor. I have submitted an issue about that too.

@StrongTown I am not able to replicate you OK status problem. Could you do as I asked earlier and export the failing gpio node (Menu > Export) and paste it here please.
Edit: Also, do you still see just OK if you remove the wire from the gpio pin?

Yes, still see the yellow "OK" with no connection.
Here is a node in the state you requested (GPIO-04, the motion detect node started working! ????). The other (unused) node in the pic below (GPIO-22) I do not know if it is working or not as it is hard to get at to test. Here is the exported contents of GPIO-04. The contents and image are captured seconds apart.

 [
     {
         "id": "efed5bbb.a2d658",
         "type": "rpi-gpio in",
         "z": "37226bbddff3ddf4",
         "name": "1 - GPIO 04 (7) NOT USED input only",
         "pin": "4",
         "intype": "up",
         "debounce": "25",
         "read": true,
         "bcm": true,
         "x": 565,
         "y": 60,
         "wires": [
             []
         ],
         "info": "Screw terminal # 1"
     }
 ]

EDIT: Not sure if it's important but GPIO 4 is header pin 7, not 4 as indicated in the code. Also, it does not (currently) remember the stat I set.

[Admin Edit] Fixed flow so that it is importable

I have fixed your post so that the flow is importable. For future reference, In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

See this post for more details - How to share code or flow json

Well I can't see any problems with that, and importing to my system does not cause an issue. The 'pin' number is badly named, it refers to the GPIO number, not the pin.

Can you open a command window and run
ps -aux |grep nrgpio
and paste the result here. Use the same technique as for posting flows, that will stop the forum messing with the layout. I want to check if the python script that interrogates the non-working pin is running, and if it is if there is anything unusual about it.

pi@Homecontroller:~ $ ps -aux |grep nrgpio
pi          8452  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 25 up 10
pi          8454  0.0  0.3 175696 12032 ?        Sl   11:18   0:12 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 25 up 10
pi          8455  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 5 up 50
pi          8457  0.0  0.3 175696 12032 ?        Sl   11:18   0:13 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 5 up 50
pi          8458  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 6 up 500
pi          8460  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 12 up 1000
pi          8461  2.7  0.3 175696 12032 ?        Sl   11:18   7:21 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 6 up 500
pi          8463  2.7  0.3 175696 12032 ?        Sl   11:18   7:19 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 12 up 1000
pi          8464  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 13 up 750
pi          8466  2.8  0.3 175696 12032 ?        Sl   11:18   7:24 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 13 up 750
pi          8467  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 16 up 100
pi          8469  2.8  0.3 175696 12032 ?        Sl   11:18   7:27 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 16 up 100
pi          8470  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 17 up 100
pi          8474  2.7  0.3 175696 11904 ?        Sl   11:18   7:19 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 17 up 100
pi          8479  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 19 up 100
pi          8483  2.8  0.3 175696 12032 ?        Sl   11:18   7:25 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 19 up 100
pi          8486  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 20 up 100
pi          8491  2.8  0.3 175696 12032 ?        Sl   11:18   7:25 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 20 up 100
pi          8492  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 21 up 100
pi          8496  2.7  0.3 175696 11776 ?        Sl   11:18   7:20 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 21 up 100
pi          8501  0.0  0.0   6800  2944 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 23 up 100
pi          8505  2.7  0.3 175696 12032 ?        Sl   11:18   7:20 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 23 up 100
pi          8506  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 27 0
pi          8508  0.0  0.3 175696 11904 ?        Sl   11:18   0:13 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 27 0
pi          8510  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 18 0
pi          8513  0.0  0.3 175696 12032 ?        Sl   11:18   0:13 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 18 0
pi          8517  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 24 up 300
pi          8522  2.8  0.3 175696 12032 ?        Sl   11:18   7:24 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 24 up 300
pi          8537  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 26 0
pi          8539  0.0  0.3 175696 12032 ?        Sl   11:18   0:11 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 26 0
pi          8556  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 22 up 250
pi          8559  2.7  0.3 175696 12032 ?        Sl   11:18   7:22 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 22 up 250
pi        254179  0.0  0.0   6772  2688 ?        S    15:43   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 4 up 25
pi        254181  144  0.3 176048 11904 ?        Rl   15:43   0:00 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 4 up 25
pi        254183  0.0  0.0   6088  1920 pts/0    S+   15:43   0:00 grep --color=auto nrgpio

Great, this looks a bit odd
pi 254181 144 0.3 176048 11904 ? Rl 15:43 0:00 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 4 up 25
It appears to be saying that the python process monitoring GPIO 4 is using 144% of a processor core (ie more than one full core), which suggests that it is looping for some reason. I am not all that familiar with the ps output so I need to do a bit or research on that.

Can you repeat the ps command please and check to see if GPIO4 is still showing a large number there? If it is then run htop and see if it shows it using the processor.

Is gpio 4 the only one not working at the moment?

My input to monitor commercial AC (a relay) feeds GPIO 25, which currently indicates green "0" (low, which is proper as AC is present) however when I remove the AC input to the relay (simulate hydro failure) the GPIO pin state does not change, so it's not working. Here is the output you requested. HTOP shows a lot of python3 gpio stuff, a lot at 0% but many in the 2-3%. Even filtered they jump around, hard to read. GPIO 4 seems to have settled.

pi@Homecontroller:~ $ ps -aux |grep nrgpio
pi          8452  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 25 up 10
pi          8454  0.0  0.3 175696 12032 ?        Sl   11:18   0:15 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 25 up 10
pi          8455  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 5 up 50
pi          8457  0.0  0.3 175696 12032 ?        Sl   11:18   0:16 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 5 up 50
pi          8458  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 6 up 500
pi          8460  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 12 up 1000
pi          8461  2.7  0.3 175696 12032 ?        Sl   11:18   9:00 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 6 up 500
pi          8463  2.7  0.3 175696 12032 ?        Sl   11:18   8:58 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 12 up 1000
pi          8464  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 13 up 750
pi          8466  2.8  0.3 175696 12032 ?        Sl   11:18   9:04 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 13 up 750
pi          8467  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 16 up 100
pi          8469  2.8  0.3 175696 12032 ?        Sl   11:18   9:07 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 16 up 100
pi          8470  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 17 up 100
pi          8474  2.7  0.3 175696 11904 ?        Sl   11:18   8:58 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 17 up 100
pi          8479  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 19 up 100
pi          8483  2.8  0.3 175696 12032 ?        Sl   11:18   9:05 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 19 up 100
pi          8486  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 20 up 100
pi          8491  2.8  0.3 175696 12032 ?        Sl   11:18   9:05 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 20 up 100
pi          8492  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 21 up 100
pi          8496  2.7  0.3 175696 11776 ?        Sl   11:18   8:58 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 21 up 100
pi          8501  0.0  0.0   6800  2944 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 23 up 100
pi          8505  2.7  0.3 175696 12032 ?        Sl   11:18   8:58 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 23 up 100
pi          8506  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 27 0
pi          8508  0.0  0.3 175696 11904 ?        Sl   11:18   0:16 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 27 0
pi          8510  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 18 0
pi          8513  0.0  0.3 175696 12032 ?        Sl   11:18   0:16 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 18 0
pi          8517  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 24 up 300
pi          8522  2.8  0.3 175696 12032 ?        Sl   11:18   9:04 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 24 up 300
pi          8537  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio out 26 0
pi          8539  0.0  0.3 175696 12032 ?        Sl   11:18   0:14 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py out 26 0
pi          8556  0.0  0.0   6800  3072 ?        S    11:18   0:00 /bin/bash /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio in 22 up 250
pi          8559  2.7  0.3 175696 12032 ?        Sl   11:18   9:01 python3 -u /home/pi/.node-red/node_modules/node-red-node-pi-gpio/nrgpio.py in 22 up 250
pi        308319  0.0  0.0   6088  1920 pts/0    S+   16:41   0:00 grep --color=auto nrgpio

[quote="StrongTown, post:36, topic:95755"]
GPIO 4 seems to have settled.
[/quote

GPIO 4 has disappeared from the ps output, so that suggests it has crashed. What do you mean by settled? What status is it showing under the node?

With GPIO 25, if you swap the wires, at the pi, between it and a working one does the fault follow the wire or stay with the pin?

I did see GPIO 4 in HTOP (filtered to 'python3') but it came and went. When it was there it wasn't high in CPU use (but can't remember exact #).

Sorry Colin but the rpi4 is not on my desktop, it's in operation in a (poorly lit) utlility room and swapping wiring is a really really challenging thing.

You can sort the output eg
htop --filter=python3 --sort-key=Command

Edit - or you can just click the column heading. Who knew? :melting_face:

Thanks jbudd.