# Modbus node doesn not receive data

**URL:** <https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992>\
**Category:** General\
**Tags:** modbus\
**Created:** [10 December 2022 12:45 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992 "2022-12-10T12:45:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bibibo-77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bibibo-77/32/72344_2.png) [@bibibo-77](https://discourse.nodered.org/u/bibibo-77)\
**Post date:** [10 December 2022 12:45 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/1 "2022-12-10T12:45:22Z")

</div>

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.

 ![Snímka obrazovky 2022-12-10 o 13.39.59](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/460f8f70b7785035f3e13610e105c03b6c39fe59.png)

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 ?

 ![Snímka obrazovky 2022-12-10 o 13.44.20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/23f41af2e44d3c08211b5d1f3f4cb81c80f31ece.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [10 December 2022 12:59 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/2 "2022-12-10T12:59:29Z")

</div>

Hi & welcome.

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

[https://discourse.nodered.org/search?q=Modbus%20Failure%20On%20State%20sending](https://discourse.nodered.org/search?q=Modbus%20Failure%20On%20State%20sending)

---

<div class="post-metadata">

**Author:** ![bibibo-77](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bibibo-77/32/72344_2.png) [@bibibo-77](https://discourse.nodered.org/u/bibibo-77)\
**Post date:** [10 December 2022 13:25 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/3 "2022-12-10T13:25:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Josov](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josov/32/6228_2.png) [@Josov](https://discourse.nodered.org/u/Josov)\
**Post date:** [12 December 2022 15:18 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/4 "2022-12-12T15:18:32Z")

</div>

@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:

```auto
  node-red:
    container_name: nodered
    image: nodered/node-red:latest
    restart: unless-stopped
    user: root
    env_file:
      - /home/pi/bin/house_config.env
    network_mode: host
    expose:
      - "80"
    privileged: true
    depends_on:
      - "mariadb"
      - "mqtt"
      - "zigbee2mqtt" 
    volumes:
      - /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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 December 2022 15:57 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/5 "2022-12-12T15:57:14Z")

</div>

> [@Josov](#):
>
> Inside a Docker container

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](https://discourse.nodered.org/t/docker-nr-ttyusb0-permission-denied/44803/17)

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 February 2023 15:58 UTC](https://discourse.nodered.org/t/modbus-node-doesn-not-receive-data/71992/6 "2023-02-10T15:58:10Z")

</div>

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