Hi, I'm trying to set up my Node-red with balena and have managed to get everything pushing correctly, and it is running the correct flow files. The issue I'm getting, however, is that my GPIO pins don't seem to be running at all.
I'm getting this error when the node-red starts in my container:
Traceback (most recent call last):
File "/usr/local/lib/node_modules/node-red-node-pi-gpio/testgpio.py", line 4, in <module>
import RPi.GPIO as GPIO
File "/usr/lib/python2.7/dist-packages/RPi/GPIO/__init__.py", line 23, in <module>
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!
I have checked that the rpi.gpio was in my dockerfile, but it still isn't working.
This is a copy of my docker file:
###
# Build step
###
FROM balenalib/raspberrypi4-64-debian-node:latest-build as build
RUN JOBS=MAX npm install -g --production --unsafe-perm \
node-red \
node-red-admin \
node-red-node-pi-gpio \
node-red-contrib-azure-iot-hub \
node-red-contrib-frequency-meter \
node-red-contrib-ibm-watson-iot \
node-red-contrib-os \
node-red-dashboard \
node-red-contrib-simpletime
###
# Runtime image
###
FROM balenalib/raspberrypi4-64-debian-node:latest-run
RUN apt-get update && apt-get install -yq --no-install-recommends \
build-essential \
rpi.gpio \
python-dev \
python-rpi.gpio \
&& apt-get clean && rm -rf /var/lib/apt/lists/* && \
# Defines our working directory in container
WORKDIR /usr/src/app
# Copy over the files created in the previous step, including lib/, bin/
COPY --from=build /usr/local/bin /usr/local/bin
COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules
# This will copy all files in our root to the working directory in the container
COPY . ./
# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"]
This is what it looks like from my flow:
Can anyone help?
Thanks