# Stop a Flow with a button on the dashboard

**URL:** https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633
**Category:** General
**Created:** [25 February 2021 17:18 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633 "2021-02-25T17:18:27Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Gerry-it](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Gerry-it](https://discourse.nodered.org/u/Gerry-it)
#### Post date: [25 February 2021 17:18 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/1 "2021-02-25T17:18:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 February 2021 18:12 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/2 "2021-02-25T18:12:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Gerry-it](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Gerry-it](https://discourse.nodered.org/u/Gerry-it)
#### Post date: [25 February 2021 18:36 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/3 "2021-02-25T18:36:54Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 February 2021 18:50 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/4 "2021-02-25T18:50:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Gerry-it](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Gerry-it](https://discourse.nodered.org/u/Gerry-it)
#### Post date: [25 February 2021 18:53 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/5 "2021-02-25T18:53:53Z")

</div>

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...

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 February 2021 19:16 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/6 "2021-02-25T19:16:06Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Gerry-it](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Gerry-it](https://discourse.nodered.org/u/Gerry-it)
#### Post date: [25 February 2021 19:25 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/7 "2021-02-25T19:25:11Z")

</div>

[{"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"}]

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 February 2021 20:40 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/9 "2021-02-25T20:40:25Z")

</div>

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](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [25 February 2021 20:59 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/10 "2021-02-25T20:59:09Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/d/9d0938b0c5a1a23affe835dae74a71064c298a7f.png)

---

<div class="post-metadata">

### Author: ![Gerry-it](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@Gerry-it](https://discourse.nodered.org/u/Gerry-it)
#### Post date: [26 February 2021 09:49 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/11 "2021-02-26T09:49:40Z")

</div>

Thank you very much!!!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 March 2021 09:50 UTC](https://discourse.nodered.org/t/stop-a-flow-with-a-button-on-the-dashboard/41633/12 "2021-03-12T09:50:34Z")

</div>

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