Are there any ways to restart a flow in NodeRed?

128 Views Asked by At

I am using a NodeRed flow to read Modbus Data from a PLC and query it to PostgreSQL and mariaDB.

There is a function which looks at a variable from the Holding Register wheter it is 0 or 1. It will only query the data if the variable is 1. My Modbus PLC extracts the data every 500ms.

My Problem is, that if there are no changes for some hours or days, I need to restart the flow or it wont be able to read out the data, even if the Modbus Node says "active".

Is there a way to restart a NodeRed Flow via a Script or in it itself?

TYVM!

1

There are 1 best solutions below

0
hardillb On

The /flows endpoint in the Admin API (docs) supports triggering a full reload of the flow which will tear down the whole flow and start it again. (you will need to set the Node-RED-Deployment-Type to reload)

This can be triggered by the flow it's self, but may require an Admin API token if httpAdminAuth is enabled.