Hi,
I have some formula nodes which work out temperatures from incoming mqtt messages, in the node they say var temp1, var temp 2 etc, my question is can i change the var to global. so that the information can be harvested to create a file with current temperatures ?
Thanks
Stuart
you can store your values in global or flow context using a change node.
function:calc temp
--> change:set global.temp to the value of msg.payload
You can also do it directly in a function node using global.set("name", value)
At some later timed event, you can then grab the value from global context
inject:every-hour
--> change:set msg.payload to value of global.temp
--> DB node (or file node or whatever)
Context is covered in the recommend playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.
1 Like
Hi Steve,
Thanks for this I will look at the videos tonight
Stuart