The problem is that the ModBus node does reconnect after the VPN disconnect and reconnect. I have set up the ModBus node to send a blank msg if the read fails. So far so good. I would then like to flow to redeploy or restart if this criteria is meet and I just can't get me head around how to use the Admin API or any other way of achieving this. I have read
And tried to understand how it works, but just cant get my head around this. Could someone share an example how to make a restart if certain criteria is meet.
If you search the forum for node red restart you will find a number of solutions. It does depend on what OS you are using, but basically the technique is to use an exec node to run a command to restart node red.
There are several threads on this forum related to this. This one uses the admin API to restart your flows via the API - import the very last flow titled "test flow:" under "Edit 2 Solution " in that link
In fact using the API is probably the preferred option as it does not need sudo privileges to do it. I must update my systems at some point to use that.