Created
March 18, 2019 20:50
-
-
Save unixweb/2be4ee0a053cef7a9830074740ee3c6e to your computer and use it in GitHub Desktop.
Node-Red Toogle Node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{"id":"3850aecb.ae7fa2","type":"function","z":"2a04a5df.aa15d2","name":"Toogle boolean","func":"/* \nif we receive a true we toogle output\nand store the new state in a local context \nwith a unique name \n*/ \nvar fname = \"toggle1\";\n\nif(msg.payload === true){\n\nif(context.get(fname) === false){\n msg.payload = true; \n}else{\n msg.payload = false;\n}\ncontext.set(fname, msg.payload);\n}\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":120,"wires":[["85e80158.2a284"]]},{"id":"85e80158.2a284","type":"combine-if","z":"2a04a5df.aa15d2","topic":"","name":"","timeout":0,"x":610,"y":120,"wires":[["ebde7127.bff24"],["e169a7ad.1e1898"]]},{"id":"5fd0d0c8.9a891","type":"inject","z":"2a04a5df.aa15d2","name":"","topic":"setup","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":120,"wires":[["3850aecb.ae7fa2"]]},{"id":"ebde7127.bff24","type":"debug","z":"2a04a5df.aa15d2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":100,"wires":[]},{"id":"e169a7ad.1e1898","type":"debug","z":"2a04a5df.aa15d2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":140,"wires":[]}] |
Author
unixweb
commented
Mar 18, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment