# Restart flow on disconnected modbus on a truenas machine

**URL:** https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472
**Category:** General
**Created:** [1 September 2021 02:14 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472 "2021-09-01T02:14:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![PPz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ppz/32/15429_2.png) [@PPz](https://discourse.nodered.org/u/PPz)
#### Post date: [1 September 2021 02:14 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472/1 "2021-09-01T02:14:03Z")

</div>

How can I restart my flow if my connected modbus poll has disconnected, whatever the error ?  
Sounds basic enough but I don't know how to handle this. I need just a simple way to process this: an error (or a disconnection, maybe not the same process), a restart.  
Many thanks

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [1 September 2021 04:28 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472/2 "2021-09-01T04:28:32Z")

</div>

What is your manual recovery process that is demonstrated to work ?

Do you have to just redeploy the flow ? Or do you have to restart the Node Red Service on the NAS ?

Craig

---

<div class="post-metadata">

### Author: ![PPz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ppz/32/15429_2.png) [@PPz](https://discourse.nodered.org/u/PPz)
#### Post date: [3 September 2021 02:07 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472/3 "2021-09-03T02:07:57Z")

</div>

I just redeploy the flow.  
Sometimes, the problem is the node-red service itself (but very very rare) and I have to restart the service on the NAS.  
But most of the error is the modbus disconnection (it's a modbus tcp/ip PLC). Restart flows and I'm on the road again.

Since 2 days, I just (blindly) added a set of functions harvested from here  
([Restart flows using Node Red API](https://discourse.nodered.org/t/restart-flows-using-node-red-api/34632)) and it seems to work. I'll dig more about this but was in a hurry to implement this to avoid losing some data.

But I don't like this kind of "black box" solution. Stay tuned, if my modbus unit is disconnected again (and some data lost), I'll know and will search for other way to solve my problem.  
But feel free to give me some theorical/practical clues.

![modbus error restart](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4e4d9a73692559046870f2710a2462c6499e038f.jpeg)

---

<div class="post-metadata">

### Author: ![PPz](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ppz/32/15429_2.png) [@PPz](https://discourse.nodered.org/u/PPz)
#### Post date: [7 September 2021 03:56 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472/4 "2021-09-07T03:56:31Z")

</div>

I added a solution found here (see previous post) but sadly, this is not the solution for me.  
I had some disconnection since and the system didn't restart, so I'm still blocked with this.  
Maybe the "Modbus read error" was not the right way to manage this or the copy/paste of the solution was wrong for me.  
Will try to bypass the "Token" function and keep the restart in case of error. Who knows ?

---

<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: [6 November 2021 03:56 UTC](https://discourse.nodered.org/t/restart-flow-on-disconnected-modbus-on-a-truenas-machine/50472/5 "2021-11-06T03:56:55Z")

</div>

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