Restart flow on disconnected modbus on a truenas machine

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

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

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) 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

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 ?