node-red

node-RED

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.

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):

global.set("MyGlobal",msg.payload);

getter (an inject node could be used in front of this node to check the value every second)

msg.payload = global.get("MyGlobal");
return msg;
  • node-red.txt
  • Last modified: 25.01.2018 05:57
  • by Pascal Suter