Stop a Flow with a button on the dashboard

Hi, I would like to STOP a flow with a Button in the nora-red UI dashboard.

The flow is checking the http-stream of a camera and detect objects on the cam picture with the tensorflow. The flow gets started with a Start-button on the Dashbaord and I keep it running with the COMPLETE node, triggered by the final node in the flow. This works fine.

No I would like to stop the flow at any time by using a second button on the Dashboard. I've tried with a SWITCH node after the "complete" node: if msg.payload from the "Stop-Button" (defined as a string "stop") the flow shall stop, otherwise (the second output of the SWITCH node) the flow continues.

But this does not work and I do not know why...?

thank you, BR

Have a look at node-red-contrib-simple-gate which you can use to block the flow using a control signal from the button.

Thank you, I've tried now. It works setting the status of the GATE with the two buttons (open and close). But in the OPEN Status the gate does not pass any messages to the HTTP REQUEST node after the gate?

Thx, BR

Does it show Open under the node?
If yes then are you sure any messages are being sent to it? If yes then are you sure nothing is coming out? Use debug nodes round it to confirm.

I have an debug node on the output of the gate node. There is never coming any output, even if i switch between OPEN and CLOSE, what is perfectly working and being showed below the gate node...

Show us what you see going into the node that isn't coming out. Set the debug to show Complete Message. Also show us how you have configured the gate node.

[{"id":"873ba9a2.78a2f8","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"478b045d.bd26ec","type":"debug","z":"873ba9a2.78a2f8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":380,"wires":},{"id":"89814044.3c586","type":"gate","z":"873ba9a2.78a2f8","name":"gate 2","controlTopic":"control","defaultState":"open","openCmd":"open","closeCmd":"close","toggleCmd":"toggle","defaultCmd":"default","statusCmd":"","persist":false,"x":490,"y":380,"wires":[["478b045d.bd26ec","a67ef40b.92f648"]]},{"id":"70f94afa.e62cf4","type":"inject","z":"873ba9a2.78a2f8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":400,"wires":[["c8c5e203.e02a4"]]},{"id":"c8c5e203.e02a4","type":"ui_button","z":"873ba9a2.78a2f8","name":"toggle","group":"1890881e.83819","order":3,"width":0,"height":0,"passthru":true,"label":"toggle","tooltip":"","color":"","bgcolor":"","icon":"","payload":"toggle","payloadType":"str","topic":"control","topicType":"str","x":310,"y":380,"wires":[["89814044.3c586"]]},{"id":"a67ef40b.92f648","type":"ui_text","z":"873ba9a2.78a2f8","group":"fdb6c31c.4f2818","order":2,"width":0,"height":0,"name":"display 1","label":"Message","format":"{{msg.payload}}","layout":"row-spread","x":660,"y":420,"wires":},{"id":"1890881e.83819","type":"ui_group","name":"Col1","tab":"c3173234.2636e","order":1,"disp":false,"width":"6"},{"id":"fdb6c31c.4f2818","type":"ui_group","name":"Gate #1","tab":"3616a722.b89bc8","order":1,"disp":true,"width":"6","collapse":false},{"id":"c3173234.2636e","type":"ui_tab","name":"RPi Control","icon":"dashboard","order":1},{"id":"3616a722.b89bc8","type":"ui_tab","name":"Home","icon":"dashboard"}]

In order to make code importable it is important to surround your code with three backticks
like this

You can edit and correct your post by clicking the pencil icon.

See this post for more details - How to share code or flow json

By devious means I have succeeded in importing your flow.
Move the inject node to the position shown below. I have adjusted the layout a bit to make it clearer where the normal flow of messages is.

Thank you very much!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.