Interrupt NR flow

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.

you could use simple gate node-red-contrib-simple-gate (node) - Node-RED
or a switch node monitoring a context value
eg.

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

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.

image

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?

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

how is yor deply button set?

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

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?

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

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?

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

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