Search code examples
node-red

How would I break or stop a running flow in node-red?


I am new to node-red and have a very basic question. How would I break or stop a running flow in node-red?

Is it possible to stop execution if a desired condition is met?


Solution

  • If you look in the settings.json (location listed in the startup log) you should find a section runtimeState

    ...
        runtimeState: {
            /** enable or disable flows/state endpoint. Must be set to `false` to disable */
            enabled: true,
            /** show or hide runtime stop/start options in the node-red editor. Must be set to `false` to hide */
            ui: true,
        },
    
    ...
    

    The defaults are false, but if you change them to true you should get a Start/Stop option on the drop down from the Deploy button:

    enter image description here

    You can also toggle it with curl, e.g.

    curl -H "Content-Type: application/json" http://localhost:1880/flows/state -d '{"state": "stop"}'