Skip to content

Instantly share code, notes, and snippets.

@heydemar
Created September 30, 2017 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heydemar/3a1264e477d19bec64c8bed57d78eed3 to your computer and use it in GitHub Desktop.
Save heydemar/3a1264e477d19bec64c8bed57d78eed3 to your computer and use it in GitHub Desktop.
Amazon Dash Button Toggle Switch ON/OFF with Traffic-Node

This flow makes it possible to switch the Node-Red traffic light to "Allow" and "Stop" with an Amazon Dash Button. You need t install:

node-red-contrib-amazondash

If you have questions contact me: http://www.imakeyouintelligent.com/

[{"id":"d492b466.1a368","type":"ButtonPressed","z":"493a3d1f.c5ee64","name":"DB_NoName","mac":"18:74:2E:29:A9:EE","x":234.44444274902344,"y":492.2221984863281,"wires":[["a198b195.cc8f98"]]},{"id":"a198b195.cc8f98","type":"function","z":"493a3d1f.c5ee64","name":"Toogle","func":"let state = context.get('state');\nlet out = \"\";\nif(state == null){\n context.set('state',false);\n}\n\nif(state == true){\n state = false;\n output = \"STOP\";\n}else{\n state = true;\n output = \"GO\"\n}\n\ncontext.set('state',state);\nreturn { \"payload\":output };","outputs":"1","noerr":0,"x":642.4444427490234,"y":490.2221984863281,"wires":[["8d131091.83c2c"]]},{"id":"8d131091.83c2c","type":"traffic","z":"493a3d1f.c5ee64","name":"","property_allow":"payload","filter_allow":"GO","ignore_case_allow":false,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"STOP","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":975.4444427490234,"y":424.2221984863281,"wires":[[]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment