First, I want to acknowlege
@RiverCityBrewer who greatly helped me getting Node Red up and running.
A Node-red flow to create a .csv file of a mash temp with time every minute.
The global element I used was named DX_gblV_Mash_Temp_DE
In addition, I have a folder
C:\BruControl\NodeRedData
To run this, you must have professional License, the Data Exchange enabled under settings, Node-Red installed and Running, and the flow in the local host on the same computer as BruControl.
This will create a simple .csv file which needs to be renamed after each Mash to a different name as this flow will create the file if it does not exist, but will simply append to the file if it does.
This flow could likely be improved as it is my first shot, but I think it would suit my needs.
The Flow:
[
{
"id": "c68aff04e20ee551",
"type": "tab",
"label": "Mash Temperature",
"disabled": false,
"info": "",
"env": []
},
{
"id": "17b429a9678c0b7c",
"type": "inject",
"z": "c68aff04e20ee551",
"name": "Start Mash Temperture",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "60",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 190,
"y": 80,
"wires": [
[
"3c74d78c0e3b11dc"
]
]
},
{
"id": "3c74d78c0e3b11dc",
"type": "http request",
"z": "c68aff04e20ee551",
"name": "Connect to BruControl",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "
http://127.0.0.1:8000/globals",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 420,
"y": 140,
"wires": [
[
"1e10d705ed8387aa"
]
]
},
{
"id": "034ac9778088f6fa",
"type": "function",
"z": "c68aff04e20ee551",
"name": "Get and Pass Mash Temp",
"func": "var arr = msg.payload; //arr for array\nvar Mash_Temp;\nvar Mash_Data;\nvar bcGlobals;\n\n//The following lines rearranges the array into a standard JSON key/value pair via a string and then makes it an object.\nbcGlobals = '{' + arr.map(function (elem) {\n return '\"' + elem.Name + '\":\"' + elem.Value + '\"';\n}).join(\",\");\nbcGlobals = bcGlobals + '}';\nbcGlobals = JSON.parse(bcGlobals);\n\n\nMash_Temp = bcGlobals['DX_gblV_Mash_Temp_DE']; //Sets Mash_Temp to the value of the BC global based on the global name. Change the name accordingly.\nnode.warn(new Date() +Mash_Temp); //Shows the value in the debug pane.\n\nmsg.payload = (new Date() + Mash_Temp); //Sets msg.payload to the DX_gblV_Mash_Temp_DE value so it can carry forward.\n\n\nreturn msg;\n\nreturn msg; //Returns the message, meaning msg.payload moves forward with the new value.",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 830,
"y": 280,
"wires": [
[
"bd321ddfc458903d",
"63caa0e376233921"
]
]
},
{
"id": "1e10d705ed8387aa",
"type": "json",
"z": "c68aff04e20ee551",
"name": "Convert JSON String to Object",
"property": "payload",
"action": "",
"pretty": false,
"x": 710,
"y": 140,
"wires": [
[
"034ac9778088f6fa"
]
]
},
{
"id": "bd321ddfc458903d",
"type": "debug",
"z": "c68aff04e20ee551",
"name": "Show Mash Temps",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1250,
"y": 280,
"wires": []
},
{
"id": "63caa0e376233921",
"type": "csv",
"z": "c68aff04e20ee551",
"name": "",
"sep": ",",
"hdrin": "",
"hdrout": "none",
"multi": "one",
"ret": "\\r\\n",
"temp": "Mash Temperture",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 1030,
"y": 440,
"wires": [
[
"aa477984d42a05fa"
]
]
},
{
"id": "aa477984d42a05fa",
"type": "file",
"z": "c68aff04e20ee551",
"name": "Write CSV File",
"filename": "C:\\BruControl\\NodeRedData\\MashTemperature.csv",
"filenameType": "str",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"encoding": "none",
"x": 1180,
"y": 440,
"wires": [
[]
]
}
]