# Interrupt NR flow

**URL:** <https://discourse.nodered.org/t/interrupt-nr-flow/40604>\
**Category:** General\
**Created:** [8 February 2021 11:44 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604 "2021-02-08T11:44:34Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [8 February 2021 11:44 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/1 "2021-02-08T11:44:34Z")

</div>

Hi folks, I just have a question about a flow that I want in NR  
I have already added a flow image. I really want to be able to interrupt the flow at the position of the star.  
The example of this flow is one of a simple solution to lower my shutters on time. I would like to interrupt these and other flows with a function when it suits me. Does somebody have happen to have any ideas how I can easily get this done.

 ![Knipsel](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/1/519f70acc696c529fee88774b86a12d1843393ba.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 February 2021 11:52 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/2 "2021-02-08T11:52:28Z")

</div>

you could use simple gate [node-red-contrib-simple-gate (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-simple-gate)  
or a switch node monitoring a context value  
eg.

```auto
[{"id":"a3f91661.792308","type":"inject","z":"57675e72.26a0d8","name":"toggle gate","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":140,"wires":[["e58791b7.f81ea"]]},{"id":"e58791b7.f81ea","type":"change","z":"57675e72.26a0d8","name":"","rules":[{"t":"set","p":"stop","pt":"flow","to":"$flowContext(\"stop\") = true ?false: true","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":140,"wires":[[]]},{"id":"2be015a1.747c62","type":"inject","z":"57675e72.26a0d8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"payload","payloadType":"str","x":80,"y":80,"wires":[["9d2a8478.f72658"]]},{"id":"9d2a8478.f72658","type":"switch","z":"57675e72.26a0d8","name":"","property":"stop","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":240,"y":80,"wires":[["348b01d6.0271de"],[]]},{"id":"348b01d6.0271de","type":"debug","z":"57675e72.26a0d8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":600,"y":60,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [8 February 2021 11:53 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/3 "2021-02-08T11:53:25Z")

</div>

Using just core nodes, you can use a global variable and a switch node, that let's the message pass depending on the state of that variable.

Alternatively, you can install the gate node to achieve the same thing.

> **[node-red-contrib-simple-gate](https://flows.nodered.org/node/node-red-contrib-simple-gate)**
>
> A gate node for node-RED

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [8 February 2021 12:22 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/4 "2021-02-08T12:22:47Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/3/139dbb8de9cccacc6d1d20b180977be383352439.png)

Hello E1cid, Thank you for your response. This gate node works perfectly indeed. I only have 1 problem. The moment I press the deploy button after a change it always goes to the open status. I would like him to maintain his status.

can you help me with that?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 February 2021 12:33 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/5 "2021-02-08T12:33:58Z")

</div>

it's difficult to help with no info except an image.

how is yor deply button set?

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [8 February 2021 12:38 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/6 "2021-02-08T12:38:35Z")

</div>

my deploy button is set on full. But even when my server is restarted, I would like it to keep its status at all times

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 February 2021 12:42 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/7 "2021-02-08T12:42:18Z")

</div>

Then store the status in a context variable, and use an inject to fire once after 0.1 seconds that feeds into a change node, that grabs stored context status and passes it to the gate node. At start up or redeploy of flows the inject should fire.

[edit]  
Before you do all that, did you check the "restore from saved" check box?

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [9 February 2021 02:46 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/8 "2021-02-09T02:46:50Z")

</div>

> [@E1cid](#):
>
> did you check the "restore from saved" check box?

If you do this, you also need to use a persistent (non-volatile) context store as the default.

---

<div class="post-metadata">

**Author:** ![Vlak](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/vlak/32/26888_2.png) [@Vlak](https://discourse.nodered.org/u/Vlak)\
**Post date:** [9 February 2021 08:24 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/9 "2021-02-09T08:24:12Z")

</div>

Dear E1cid, I have checked this box but this makes no difference.  
"Then store the status in a context variable"  
can you tell me how to do this?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [9 February 2021 08:34 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/10 "2021-02-09T08:34:59Z")

</div>

> [@drmibell](#):
>
> If you do this, you also need to use a persistent (non-volatile) context store as the default.

Have you tried this.  
[https://nodered.org/docs/api/context/store/localfilesystem](https://nodered.org/docs/api/context/store/localfilesystem)  
when you start node-red, when it loads it tell you where your settings.js is.

---

<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:** [10 April 2021 08:35 UTC](https://discourse.nodered.org/t/interrupt-nr-flow/40604/11 "2021-04-10T08:35:36Z")

</div>

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