Simple gate to switch on and off a flow

Hi there,
I found this flow here in the forum:

https://flows.nodered.org/flow/a985944e789d90e0cd2008d85b7aaa65

That is almost exactly what I am looking for .... I only need a second output so that the message takes the output "1" or "2" depending on whether the switch is set to "on" or "off".

you can rewrite the code in the gate that it works that way

Greetings Volker

Are you asking a question? If so then it is not clear what the question is.

Though slightly different, this flow does what you want - I think.

[{"id":"562ebf47.7816e","type":"inject","z":"b4f1ccd4.5e8d1","name":"1","topic":"control","payload":"1","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":2910,"wires":[["dfc4d3fa.da9c3"]]},{"id":"362d4e1a.8ac26a","type":"inject","z":"b4f1ccd4.5e8d1","name":"2","topic":"control","payload":"2","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":200,"y":2950,"wires":[["dfc4d3fa.da9c3"]]},{"id":"dfc4d3fa.da9c3","type":"change","z":"b4f1ccd4.5e8d1","name":"","rules":[{"t":"set","p":"router","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":2930,"wires":[[]]},{"id":"e8c699c1.7bd3d","type":"inject","z":"b4f1ccd4.5e8d1","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":3070,"wires":[["f57f5c83.093b4"]]},{"id":"f57f5c83.093b4","type":"switch","z":"b4f1ccd4.5e8d1","name":"","property":"router","propertyType":"flow","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":3070,"wires":[["6eea1b84.8be9ac"],["a2c95c56.ee0cd"]]},{"id":"6eea1b84.8be9ac","type":"debug","z":"b4f1ccd4.5e8d1","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":3030,"wires":[]},{"id":"a2c95c56.ee0cd","type":"debug","z":"b4f1ccd4.5e8d1","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":550,"y":3100,"wires":[]}]

It won't do anything until you press the 1 or 2 button (inject node)

BONUS!

If you add a third inject node to where the 1 and 2 are, and make it..... (anything else):
When you press that button the output will stop.

(Looking at your "picture".... You love it when a plan comes together - yes?)

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