# Modbus Read Node via Modbus TCP in Node Red

**URL:** <https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365>\
**Category:** General\
**Tags:** modbus\
**Created:** [27 June 2026 01:36 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365 "2026-06-27T01:36:34Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [27 June 2026 01:36 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/1 "2026-06-27T01:36:34Z")

</div>

Dear Guys.  
I'm use Modbus Read node from default library Modbus to read data from modbus Server.  
The connection was established and work Ok.  
But there is a small problem.  
when Connection is normal, Modbus Read will return layload normally with array result.  
But if because some of reasons, the server lost connection with modbus, the payload will hod the last result before lost connection. I don't want like that.  
I want, if connection lost., Modbus read will return array with all elements in the results array are zero.  
Is that Posible?  
Many thank

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [27 June 2026 05:35 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/2 "2026-06-27T05:35:55Z")

</div>

In your Modbus read node try enabling the option "Empty msg on Modbus fail"

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/9998b7ae3f943d5fa8b0eeeaee9710b3b92054ce.png)

Its not going to do exactly what you need which is all elements to be zero .. but it _should_ produce an empty msg .. which can give you an indication of a failed connection.

That msg can then be manipulated to whatever you need.

---

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [27 June 2026 06:44 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/3 "2026-06-27T06:44:42Z")

</div>

I tried your solution, but it l also do not work

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 08:03 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/4 "2026-06-27T08:03:41Z")

</div>

Add a debug node after the modbus node and show us what it shows when the connection fails.

---

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [27 June 2026 10:32 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/5 "2026-06-27T10:32:26Z")

</div>

Hi Colin  
When Rad Modbus or Modbus Flex getter lost connection, no message was shoed via debug.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 10:52 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/6 "2026-06-27T10:52:54Z")

</div>

You said in your first post that it keeps sending the old data

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 11:02 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/7 "2026-06-27T11:02:48Z")

</div>

If you want to take action when no data are received then use a Trigger node. Set it to Send Original Message, Then Wait For 10 seconds, then Send whatever message you need. Then if there is a gap of 10 seconds in the data stream it will send the message you have configured.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 11:17 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/8 "2026-06-27T11:17:14Z")

</div>

Also, if you just need to update a display to show no data then you can tell the Trigger node to send the timeout message to the second output and use that output to send an appropriate value to the displays.

---

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [27 June 2026 15:53 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/9 "2026-06-27T15:53:02Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/a/ea5197ef4f53ae1b814d57faf6e7d81ae15e90cd.png)  
Dear Sir  
I used function node in front of Modbus Flext getter.  
I mean that, when lost connection with server, no output payload.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 16:47 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/10 "2026-06-27T16:47:43Z")

</div>

Use a Trigger node as I suggested.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 June 2026 19:45 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/11 "2026-06-27T19:45:10Z")

</div>

Connect the Trigger node to the output of the modbus node, obviously.

---

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [28 June 2026 03:23 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/12 "2026-06-28T03:23:42Z")

</div>

HI Guys.  
I also tried to use trigger. But it still didn't resolce problem

---

<div class="post-metadata">

**Author:** ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)\
**Post date:** [28 June 2026 04:00 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/13 "2026-06-28T04:00:27Z")

</div>

There was a breaking change, for a few years now, in the latest versions of the Modbus nodes and "Empty msg on Modbus fail" isnt working when there is a connection failure.

In your terminal go to your `.node-red` folder and run

`npm i node-red-contrib-modbus@5.23.3`

This will install the older version of modbus 5.23.3

Restart node-red and test again if with this specific version you get an empty msg.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 June 2026 08:57 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/14 "2026-06-28T08:57:06Z")

</div>

> [@Boy\_co\_don](#):
>
> I also tried to use trigger. But it still didn't resolce problem

Please export you flow with the trigger node so I can see what you have done.

---

<div class="post-metadata">

**Author:** ![Boy\_co\_don](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@Boy\_co\_don](https://discourse.nodered.org/u/Boy_co_don)\
**Post date:** [28 June 2026 09:45 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/15 "2026-06-28T09:45:15Z")

</div>

Dear Sir.  
Can you remote directly to my node-red and check  
many thank

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 June 2026 10:23 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/16 "2026-06-28T10:23:41Z")

</div>

Select the nodes that you showed the image of earlier, plus the Trigger node, then hit CTRL+E and click Export to Clipboard.

Then paste the flow here. In order to make flow usable it is necessary to surround it with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<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:** [27 August 2026 10:24 UTC](https://discourse.nodered.org/t/modbus-read-node-via-modbus-tcp-in-node-red/101365/17 "2026-08-27T10:24:02Z")

</div>

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