8. Adding Data to Template Node

Next, we will populate the template node with data from two different motors. We will insert an inject node and a function node and connect them to each other.
Double-click on the function node and copy the following code
min = Math.round(Math.random()*1000);
max = Math.round((Math.random()*10000)+1000);
msg.payload = {
factory: {
machine00: {
min: min,
max: max,
failProb: 20,
name: "Motor 1"
machine01: {
min: min*5,
max: max*2,
failProb: 10,
name: "Motor 2"
return msg;
and change the name to Generate Data.
Click Done once the function is complete.
We will use the inject node to trigger this function every 3 seconds. To do this, double-click on each inject node and change the following parameters.
Click Done after parameters are set.
Drag and drop a comment node and name it Water Filtration. Click Deploy and go to your dashboard page to see your progress.