There have been a couple of case where something was falsing the detector and a dashboard button would be ideal to temporarily disable the flow while away from home. Using a form C relay with a rpi output node prior to connecting to the input is a thought but kind of messy.
The button sets variable with a value of stop and if the switch node doesn't see a stop value it continues otherwise it stops
var state = context.get("state") || "on";
// Display initial state statusif(state == "on"){ node.status({fill:"green",shape:"dot",text:state});}else{ node.status({fill:"red",shape:"ring",text:state});}
if(msg.topic == "state"){ context.set("state",msg.payload); state = msg.payload; // update status if(state == "on"){ node.status({fill:"green",shape:"dot",text:state}); }else{ node.status({fill:"red",shape:"ring",text:state}); }}else{ if(state == "on"){ return msg; }}
[{"id":"b4e4d9ee.93b458","type":"debug","z":"e4f38591.2bd518","name":"Gated Flow Data","active":true,"console":"false","complete":"true","x":630,"y":140,"wires":[]},{"id":"54f28527.00ee2c","type":"inject","z":"e4f38591.2bd518","name":"","topic":"state","payload":"on","payloadType":"str","repeat":"","crontab":"","once":true,"x":180,"y":180,"wires":[["d8744d0e.71c98"]]},{"id":"d3f36679.cfa508","type":"inject","z":"e4f38591.2bd518","name":"","topic":"state","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":180,"y":220,"wires":[["d8744d0e.71c98"]]},{"id":"4dea7961.6a9858","type":"inject","z":"e4f38591.2bd518","name":"Sample Data","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":190,"y":140,"wires":[["d8744d0e.71c98"]]},{"id":"1ddb616c.3268bf","type":"comment","z":"e4f38591.2bd518","name":"Sample Flow Toggle","info":"","x":150,"y":100,"wires":[]},{"id":"d8744d0e.71c98","type":"function","z":"e4f38591.2bd518","name":"Flow On/Off","func":"var state = context.get(\"state\") || \"on\";\n\n// Display initial state status\nif(state == \"on\"){\n node.status({fill:\"green\",shape:\"dot\",text:state});\n}else{\n node.status({fill:\"red\",shape:\"ring\",text:state});\n}\n\nif(msg.topic == \"state\"){\n context.set(\"state\",msg.payload);\n state = msg.payload;\n // update status\n if(state == \"on\"){\n node.status({fill:\"green\",shape:\"dot\",text:state});\n }else{\n node.status({fill:\"red\",shape:\"ring\",text:state});\n }\n}else{\n if(state == \"on\"){\n return msg;\n }\n}\n","outputs":1,"noerr":0,"x":410,"y":140,"wires":[["b4e4d9ee.93b458"]]}]
[{"id":"9b30c49d.23c808","type":"link in","z":"e4f38591.2bd518","name":"LED Matrix Body","links":[],"x":115,"y":440,"wires":[["78b4f577.bbb37c"]]},{"id":"78b4f577.bbb37c","type":"function","z":"e4f38591.2bd518","name":"Flow On/Off","func":"var state = context.get(\"state\") || \"on\";\n\n// Display initial state status\nif(state ==\"on\"){\n node.status({fill:\"green\",shape:\"dot\",text:state});\n}else{\n node.status({fill:\"red\",shape:\"ring\",text:state});\n}\n\nif(msg.topic == \"state\"){\n context.set(\"state\",msg.payload);\n state = msg.payload;\n // update status\n if(state == \"on\"){\n node.status({fill:\"green\",shape:\"dot\",text:state});\n }else{\n node.status({fill:\"red\",shape:\"ring\",text:state});\n }\n}else{\n if(state == \"on\"){\n return msg;\n }\n}\n","outputs":1,"noerr":0,"x":312.4999942779541,"y":437.5,"wires":[["f089d4f2.540eb8"]]},{"id":"382c1f46.1a368","type":"ui_switch","z":"e4f38591.2bd518","name":"","label":"Dynamic Input","group":"db5b2edd.a99d6","order":0,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"state","style":"","onvalue":"on","onvalueType":"str","onicon":"","oncolor":"","offvalue":"off","offvalueType":"str","officon":"","offcolor":"","x":322.4999942779541,"y":397.5,"wires":[["78b4f577.bbb37c"]]},{"id":"bd2a6c0a.e0d1c","type":"inject","z":"e4f38591.2bd518","name":"","topic":"state","payload":"on","payloadType":"str","repeat":"","crontab":"","once":true,"x":162.4999942779541,"y":357.5,"wires":[["382c1f46.1a368"]]},{"id":"69f9bd3d.49c5f4","type":"inject","z":"e4f38591.2bd518","name":"","topic":"state","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"x":162.4999942779541,"y":397.5,"wires":[["382c1f46.1a368"]]},{"id":"f089d4f2.540eb8","type":"debug","z":"e4f38591.2bd518","name":"","active":true,"console":"false","complete":"false","x":570,"y":440,"wires":[]},{"id":"319099d0.d0a5d6","type":"comment","z":"e4f38591.2bd518","name":"Sample Flow Toggle with UI and Link input","info":"","x":220,"y":320,"wires":[]},{"id":"db5b2edd.a99d6","type":"ui_group","z":"","name":"Flow Toggle","tab":"b405a340.8e78d","disp":true,"width":"6"},{"id":"b405a340.8e78d","type":"ui_tab","z":"","name":"Sandbox","icon":"dashboard"}]
Perhaps the node-red-contrib-traffic node could be a (simpler) solution for your case?? I haven't used it yet, and I'm currently a few days computer-less (so I cannot test it at this moment). But it's only purpose is to pass and block messages.
I'm very curious whether it fits your needs, so please give feedback (if you should try it).
Kind regards,
Bart Butenaers