Friday 29 November 2019

Node-Red Notes

My rough notes for using the excellent Node-Red

To perform simple maths on the payload data, use the function node :
var payload=msg.payload;
msg.payload = (20. * payload / 1024.) - 2.3;
return msg;

To take input values 0/1 and use to control an indicator switch :

var payload=msg.payload;
if (payload == 1) {
  msg.payload = true;
} else {
  msg.payload = false;
}
return msg;

Securing Node-Red was really straight forward using the following guide :
http://www.steves-internet-guide.com/securing-node-red-ssl/
node-red-admin wasn't on my Raspberry Pi installation but this worked :
node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" password

Getting Chrome To Load Self-signed certificate - https://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate

If you have found this solution useful then please do hit the Google (+1) button so that others may be able to find it as well.

Numerix-DSP Libraries : http://www.numerix-dsp.com/eval/