How do I connect to an rfxtrx from Node-RED in container with Docker Compose?

I have searched around and tried several different solutions (instead of working, as I should be...), and I can't get this to work. This is my Docker Compose file:

version: "3.7"

services:
  node-red:
    user: 1000:1000
    image: nodered/node-red:latest
    restart: unless-stopped
#   group_add:
 #      - dialout
    environment:
      - TZ=Europe/Oslo
      - LD_LIBRARY_PATH=/opt/vc/lib
    ports:
      - "1880:1880"
    networks:
      - node-red-net
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0"
    volumes:
      - /home/pi/Node-RED:/data
      - /home/pi/Sikkerhetskopier:/home/pi/Sikkerhetskopier
networks:
  node-red-net:

I'm using my own user, and I am in the dialout group. But I still can't connect to the rfxtrx. I know it's on the right port. I think the problem is that dialout isn't added correctly, and when I try to run with the now commented out group add, I get an error message:

./entrypoint.sh: line 14: 8 Segmentation fault (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"

Does anybody know what I should do to get it working? It's the final important thing that's not working before I can go all Docker on all my home automation stuff.

Have you tried changing permissions on the OS port to make it available to everyone? Don't recommend leaving it that way but it would confirm or eliminate the group membership as the issue.

@TotallyInformation Thanks for answering! I used sudo chmod 777 /dev/ttyUSB0 And that actually made the same error surface, this time without adding the container to the group. It actually looks like it's when the Node-RED container can access the RFXtrx that error comes! Confuses me more and more...

Edit: I don't know if the full startup helps? And I have tested a few times, and it really does happen when the USB port is available.

nodered | 16 Oct 19:50:01 - [info] Node-RED version: v3.1.0
nodered | 16 Oct 19:50:01 - [info] Node.js version: v16.20.2
nodered | 16 Oct 19:50:01 - [info] Linux 6.1.21-v7l+ arm LE
nodered | 16 Oct 19:50:03 - [info] Loading palette nodes
nodered | 16 Oct 19:50:07 - [warn] rpi-gpio : Raspberry Pi specific node set inactive
nodered | 16 Oct 19:50:08 - [warn] ------------------------------------------------------
nodered | 16 Oct 19:50:08 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
nodered | 16 Oct 19:50:08 - [warn] ------------------------------------------------------
nodered | 16 Oct 19:50:08 - [info] Settings file : /data/settings.js
nodered | 16 Oct 19:50:08 - [info] Context store : 'default' [module=memory]
nodered | 16 Oct 19:50:08 - [info] User directory : /data
nodered | 16 Oct 19:50:08 - [warn] Projects disabled : editorTheme.projects.enabled=false
nodered | 16 Oct 19:50:08 - [info] Flows file : /data/flows.json
nodered | 16 Oct 19:50:08 - [info] Server now running at http://127.0.0.1:1880/
nodered | 16 Oct 19:50:08 - [warn] Using unencrypted credentials
nodered | 16 Oct 19:50:08 - [info] Starting flows
nodered | ./entrypoint.sh: line 14: 7 Segmentation fault (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"
nodered exited with code 0

I deleted the setup, copied in only the flows in and installed the nodes from scratch. And now it works! The problem is that I have another error now:

(node:7) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 temphumbaro1 listeners added to [RfxCom]. Use emitter.setMaxListeners() to increase limit

And a bit more searching shows that it's just because I have a lot of inputs for the RFXtrx, so nothing to worry about. Seems like I'm up and running!

Yes, that is just a warning. I seem to remember there's a way to get rid of it but I no longer remember how sorry. I use an RFXtrx433e by the way.

Glad you sorted it. A reinstall was my next advice on the assumption that you had something corrupted.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.