Search code examples
node-red

Node-Red: How to know if a flow is currently been executed or not?


Q: Is there an easy way to know the current state of a flow? Either through the backend or front end.

For instance, I would like to know if my flow is currently running or not.

If it is, which particular node(s) are executing at the moment?

I know some of the nodes actually has a small label to explain its state like 'requesting...' but not all nodes has it.


Solution

  • If a flow1 is deployed then it is available to run. Node-RED will load the last deployed flow at start up. They will normally wait for an external trigger (e.g. MQTT message, HTTP request...) to start or for a timer (e.g. inject node) to kick off a message flowing down a path of nodes.

    There is no generic way to know if a message is currently traversing a string of nodes (The Node-RED editor is not meant to be a dashboard showing complex state) but some nodes may set their status (the small coloured dot and a short section of text under the node) to show if it is working with a message.

    You can add debug nodes at various places along the path that will output when a messages passes that point. But be aware that the order things happen when there are branches in the flow may not be intuitive (forks are followed in the order they are created, but may pause if a blocking call is made and jump to the other fork).

    You can turn on the very verbose logging that shows the timing for the message passing through the flow, but this is not really user friendly to read.

    1 in the global sense. (Flow is a very overloaded term, it can mean a string of nodes, a tab in the editor and the whole collection of tabs)