My problem was very specific and I didn't find answers/help even after posting some questions in various forum: how to restart node-red (running on my TrueNas) flows when my external TCP modbus device is no more communicating ?
The problem is about the same with serial communication or "any" external device (MQTT ?) that can be disconnected for various reasons, including unknowns.
I tried several functions, handling errors, searching ways to restart flows and learned a little bit more.
This is my solution. I'm sure skilled people here will say something like "pretty obvious", but the Internet is big and Google didn't help me.
I could probably replace the switch node with a function (something like IF status = Disconnected then restart), but the switch node was easier for me.
I monitor the status of my modbus connection. At first, I tried handling errors, but anything (including polling) returned an "error".
Secondly, I put debug windows to know all status messages for my modbus device.
When I understood that I have to manage only Connected and Disconnected messages to solve my problem, the switch was the key.
I found here the solution for the restart flows problem and hooked the pieces together to obtain my solution:
and more precisely, the solution was from him (AsHex_66):
I added as a security a timer to reset the flows everyday at 5AM, activated a button into HE to see the last restart and voilà, everything is working now as expected
When my modbus unit is Disconnected (for any reason), the flows restart and my problem is solved !
An easier way ?