Modbus node doesn not receive data

Hello, i try to read one address from my device but the error "Modbus Failure On State sending Get More About It By Logging" appears.

I sniffed the communication and it seems the communication works correct. I don not uderstand why the Modbus node cannot show aswer from device. Can You help me with this issue ?

Hi & welcome.

Your first port of call should be a forum search. This has come up more than once...

I have tried searching, but I didn't find solution for my problem.

@Steve-Mcl l extensively looked for a solution but did not find.

However in order to help others I managed to find the solution. Inside a Docker container the $USER environment variable is an empty string. If you use whoami inside a terminal of your Node-RED Docker container the user is "node-red". This user only exists inside the container, is not member of a group and has no access to devices. This is causing trouble if you want to access serial ports. The simple solution is to add a user directive in the docker-compose.yml configuration file as follows:

    container_name: nodered
    image: nodered/node-red:latest
    restart: unless-stopped
    user: root
      - /home/pi/bin/house_config.env
    network_mode: host
      - "80"
    privileged: true
      - "mariadb"
      - "mqtt"
      - "zigbee2mqtt" 
      - /home/pi/docker/nodered/node_red_data:/data
      - /dev:/dev

I use docker-compose and I assume the problem is the same in docker. It resolves docker problems with Modbus, Serialport and SmartMeter. I tested in a 64-bit Raspberry Pi environment.

That really should have been in your OP & in the title - it changes many things. In fact after a few more questions, you would likely have been pointed to this: Docker NR & ttyUSB0 Permission denied - #17 by janvda

In short, please mention things like "docker" or "containerised" in your OP because it changes a lot of things.

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