I am using node-red-node-pi-gpio 2.0.6 and node-red-dashboard 3.4.0 with node-red installed on a Raspberry Pi 4 via the "installing on a Raspberry Pi" instructions. My Pi runs Raspberry Pi OS (Debian 11) and I ran into a problem similar to "Keyboard Node error when trying to deploy". My error is similar but not the same and I solved it. So I want to share the solution because I think others may run into this.
My Node Red setup is a controller for my swimming pool. I created a dedicated user named
pool on the Pi and then I installed node-red as the
pool user. Everything worked great. But when I added the rpi-keyboard node and deployed it, I would see a little green "OK" which immediately turned to "Stopped" underneath the keyboard node on my flow. It just goes back and forth from "OK" to "Stopped" and back. It doesn't generate keyboard output.
The solution is fairly simple, but needs to be done one time. Whatever Linux user is running the node-red software (
pool in my case) needs to be a member of the
input group (in
/etc/group). That's what gives it permission to read the keyboard and mouse devices. So, for me, the solution was:
sudo gpasswd -a pool input sudo gpasswd -a pool gpio
Then I restarted node-red via:
sudo systemctl restart nodered
and everything worked. It's possible I missed a step somewhere during the installation which would have done this for me automatically. I dunno. But that's the problem and that's the solution.
If I understand the node-red-node-pi-gpio code, it seems like the
nrgpio.py program doesn't generate any error message at all when it fails to open the keyboard. It took a while to track this down because I couldn't find any error messages. I might not understand the code, so this may all be a (node) red herring.
Hope this helps someone in the future.