Simple gate to switch on and off a flow
A simple flow demonstrating how to use a switch in a dashboard to turn on and off a flow of information in the server. This shows how to combine two inputs and use one of them to control the other.
[{"id":"af07d51.5afe728","type":"ui_switch","z":"d629259e.613838","name":"","label":"switch","group":"415ff655.a1d8f8","order":0,"width":0,"height":0,"passthru":true,"topic":"gate","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":245.5,"y":1005,"wires":[["c8edc66a.057cb8"]]},{"id":"c8edc66a.057cb8","type":"function","z":"d629259e.613838","name":"control","func":"if (msg.topic === \"gate\") {\n context.pass = (msg.payload === true) ? true : false;\n return null; // exit out early as it's just the control\n}\nif (context.pass) {\n return msg; // if enabled pass msg\n}\nreturn null; // or drop it","outputs":1,"noerr":0,"x":433.5,"y":1025,"wires":[["bd6caa17.447778"]]},{"id":"5bb586be.00a6a8","type":"inject","z":"d629259e.613838","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"x":268,"y":1067,"wires":[["c8edc66a.057cb8"]]},{"id":"bd6caa17.447778","type":"debug","z":"d629259e.613838","name":"","active":true,"console":"false","complete":"payload","x":644,"y":1026,"wires":[]},{"id":"415ff655.a1d8f8","type":"ui_group","z":"","name":"Default","tab":"622a3108.4411e","disp":true,"width":"6"},{"id":"622a3108.4411e","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]