# Node-red-contrib-modbus no reconnect

**URL:** <https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309>\
**Category:** General\
**Created:** [28 August 2021 00:24 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309 "2021-08-28T00:24:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![larslehman1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/larslehman1/32/47111_2.png) [@larslehman1](https://discourse.nodered.org/u/larslehman1)\
**Post date:** [28 August 2021 00:24 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/1 "2021-08-28T00:24:12Z")

</div>

Hi,

my Problem my Modbus not reconnect.

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/e/be1c819e888705a65272cb323b4ff629a3425954.png)  
I want to implement Modbus devices that can fail for 1 to 2 hours at any time.  
After a short time the Modbus client should try to establish a connection to the device. After the reconnect timer has expired, I only get a connection again when I press deploy.

---

<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 August 2021 03:28 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/2 "2021-08-28T03:28:58Z")

</div>

Read this thread .. possibly related.

> [@Modbus TCP client not reconnecting after modbus server goes offline](https://discourse.nodered.org/t/modbus-tcp-client-not-reconnecting-after-modbus-server-goes-offline/50264):
>
> I am running a modbus TCP client (node-red-contrib-modbus) on a node red inside a docker container. However, when the server goes offline and comes online - it's not reconnecting - it shows "reconnecting after 2000 msec" message. Any thoughts to re establish the connection ?

---

<div class="post-metadata">

**Author:** ![larslehman1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/larslehman1/32/47111_2.png) [@larslehman1](https://discourse.nodered.org/u/larslehman1)\
**Post date:** [28 August 2021 13:33 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/3 "2021-08-28T13:33:02Z")

</div>

after the connection is lost, the node is in the init status. This status does not change even if the Modbus device can be reached again. The Modbus Node print the Message "Error: Client Not Ready To Read At State init"

---

<div class="post-metadata">

**Author:** ![larslehman1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/larslehman1/32/47111_2.png) [@larslehman1](https://discourse.nodered.org/u/larslehman1)\
**Post date:** [28 August 2021 14:06 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/4 "2021-08-28T14:06:03Z")

</div>

1. lost Connection (I stop the modbus server for a few minutes) ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7bd14f6ee3654ebbf178c13dc18be1afa8e04ab0.png)
2. after a short time change to init Status. I start the Modbus server and the status never changes  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5ba8516c373cd83cda2b8a8ccda932c287447754.png)  
As soon as I restart the NodeRed or press the deploy button, everything works normally again (data is retrieved)  
I've already tried increasing the interval of Inject(Timer). However, I couldn't see any improvement

---

<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 August 2021 14:32 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/5 "2021-08-28T14:32:06Z")

</div>

I see you have in your Modbus config the option to **"Reconnect on timeout"** checked  
theoretically it should reconnect.

What nodejs version do you have ?

---

<div class="post-metadata">

**Author:** ![larslehman1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/larslehman1/32/47111_2.png) [@larslehman1](https://discourse.nodered.org/u/larslehman1)\
**Post date:** [28 August 2021 14:47 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/6 "2021-08-28T14:47:50Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b177a703978853623036321a867183de4415f603.png)

---

<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 August 2021 14:51 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/7 "2021-08-28T14:51:04Z")

</div>

ok .. so this is the problem .. you are running Nodejs v14  
you have to downgrade to v12 ..  
until a fix /update is ready for these Modbus nodes (there is some discussion on the node's github page)

* * *

I see the version of Node-red is couple of versions behind  
since you are on a Linux based system .. running the [official installation script](https://nodered.org/docs/getting-started/raspberrypi) with the `--node12` parameter should downgrade your nodejs to 12 and upgrade your Node-red to the latest 2.0.5

`bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node12`

---

<div class="post-metadata">

**Author:** ![larslehman1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/larslehman1/32/47111_2.png) [@larslehman1](https://discourse.nodered.org/u/larslehman1)\
**Post date:** [28 August 2021 15:10 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/8 "2021-08-28T15:10:41Z")

</div>

Thanks, I change my Version to 12.13.0 and my problem is fixed.  
@UnborN Thank you again for your quick help. 🙂

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 August 2021 17:36 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/9 "2021-08-28T17:36:21Z")

</div>

thanks @UnborN - love the way this community really steps up and sorts things out.

---

<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:** [11 September 2021 17:36 UTC](https://discourse.nodered.org/t/node-red-contrib-modbus-no-reconnect/50309/10 "2021-09-11T17:36:38Z")

</div>

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