With the function node i get a error. I think it change after a update of node red. I dont get de Function tab but now there is On Message tab. With var in front the error is gone. Perfect tutorial by the way. var raw_time = new Date().getTime(); var timestamp = Math.round(raw_time / 1000); var watt = "'" + msg.payload + "'"; `` var insert = "INSERT INTO solar (timestamp, watt)" + " VALUES (" + timestamp + ", " + watt + ")"; msg.topic = insert; return msg;
Thanks for watching! Since Node-RED is essentially a wrapper for node.js, you can use node to run your own text JavaScript programs without the web interface on groov EPIC, RIO, and most other systems. Node-RED also exposes JavaScript code through function nodes.
With the function node i get a error. I think it change after a update of node red. I dont get de Function tab but now there is On Message tab. With var in front the error is gone.
Perfect tutorial by the way.
var raw_time = new Date().getTime();
var timestamp = Math.round(raw_time / 1000);
var watt = "'" + msg.payload + "'";
``
var insert = "INSERT INTO solar (timestamp, watt)" +
" VALUES (" + timestamp + ", " + watt + ")";
msg.topic = insert;
return msg;
Great and informative as always. Thanks
you are the best!
Is there some text-based alternative to Node-RED?
Thanks for watching! Since Node-RED is essentially a wrapper for node.js, you can use node to run your own text JavaScript programs without the web interface on groov EPIC, RIO, and most other systems.
Node-RED also exposes JavaScript code through function nodes.