I am trying to add an RFXtrx to a Pi that hasn't had one before. But I keep getting this:
[rfxcom] on /dev/ttyUSB0 - Error: Permission denied, cannot open /dev/ttyUSB0
This is my Docker Compose file:
services:
node-red:
build:
dockerfile_inline: |
FROM nodered/node-red:4.0.9-debian
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends iputils-ping sshpass openssh-client
USER node-red
container_name: Node-RED
privileged: true
restart: no
group_add:
- "20"
environment:
- TZ=Europe/Oslo
network_mode: host
devices:
- /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A12VLOW7-if00-port0:/dev/ttyUSB0
volumes:
- /media/pi/Docker/Docker-Compose/Node-RED/Data:/data
- /media/pi/Docker/Docker-Compose:/home/pi/Docker-Compose:ro
- type: bind
source: /home/pi/Node-RED-omstarter.txt
target: /home/pi/Node-RED-omstarter.txt
- type: bind
source: /home/pi/.ssh/known_hosts
target: /usr/src/node-red/.ssh/known_hosts
I have checked that ttyUSB0 excists in the container with docker exec -it Node-RED bash and ls in the dev directory. So it seems that Node-RED within the container isn't allowed to use the USB0. I have three other Pi's running the same setup, and they work, but they have been through lots of generations of both Pi's, Pi OS and Node-RED, so I can't find out what I did different there. I ran sudo usermod -aG docker pi in the hope that it would change anything, which it didn't. So my limited understanding has reached it's end. I hope somebody can help me with this one.

