CHAPTER 4 ■ COMPLEX FLOWS: NODE-RED
Listing 4-1. Code for Converting a String to a Number
msg.payload.requestVar = parseInt(msg.payload.requestVar);
return msg;
At this point, your light sensor will send readings every few seconds whether it’s
sunny or not. So within the Node-RED flow, you need to add a rule to check if the sensor
value has crossed a certain threshold and only tweet when that threshold has been
crossed.
Figure 4-14. Function node properties dialog box