This shows you the differences between two versions of the page.

Link to this comparison view

node-red [25.01.2018 05:57] (current)
Pascal Suter created
Line 1: Line 1:
 +====== node-RED ======
 +[[https://​nodered.org|Node-Red]] is a rules engine based on node.js with its focus set to IoT applications. It comes with a nice looking web-interface where you can graphically program "​Flows"​ from input modules all the way through to output modules. Currently (jan 18) there are about 2000 input/​output modules called "​nodes"​ available. ​
 +===== Tricks =====
 +==== Set/Receive global Variable ====
 +a global variable can be accessed in all flows. also it can "​store"​ a state (probably for as long as node-red is running, haven'​t tested what a restart of all flows will do to a global yet) 
 +we need a setter and a getter function for our global variable, so create two new function nodes with the following code: 
 +setter (acts as an output node): <code javascript>​
 +getter (an inject node could be used in front of this node to check the value every second)
 +<code javascript>​
 +msg.payload = global.get("​MyGlobal"​);​
 +return msg;