Hi J,
Thanks for that, it was really helpful and works OK with what I'm doing
I've exported the front end of the logging section, just up to the point that the formatted CSV row string is then passed on the to the filename constructor, csv node and file append (as the back end works OK).
My second problem is how to use a user-enterable value as the log-rate, via a numeric input (with that value then sent to a flow-var).
I've got it currently setup used an inject node with a 5 second repeat in the example and I've tried it with a trigger and a loop timer (additional node install), but I haven't figured out a way to use a flow-var as part of the timing). Any suggestions?
Many thanks.
[
{
"id": "3d7d17a620f1054b",
"type": "tab",
"label": "Flow 2",
"disabled": false,
"info": "",
"env": []
},
{
"id": "27f2ba6bc9cd4809",
"type": "function",
"z": "3d7d17a620f1054b",
"name": "Configure CSV row",
"func": "var PUMP_RPM = flow.get('PUMP_RPM') || 0;\nvar PRESSURE = flow.get('PRESSURE') || 0;\nvar TIMEO = flow.get('TIMEO') || 0;\nvar MASS = flow.get('MASS') || 0;\nvar TEMP = flow.get('TEMP') || 0;\nvar DO = flow.get('DO') || 0;\nvar NEEDLE = flow.get('NEEDLE') || 0;\nvar COMMENT = flow.get('COMMENT') || 0;\nmsg.payload = {\n \"Timestamp\": TIMEO,\n \"Pressure_mbar\": PRESSURE,\n \"Pump_RPM\": PUMP_RPM,\n \"Mass_gr\": MASS,\n \"Temp\" : TEMP,\n \"DO\" : DO,\n \"Needle_valve_turns_open\": NEEDLE,\n \"Comment\": COMMENT\n}\nreturn msg; \n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 260,
"wires": [
[
"d0f92babef87e3cf"
]
]
},
{
"id": "d0f92babef87e3cf",
"type": "gate",
"z": "3d7d17a620f1054b",
"name": "",
"controlTopic": "control",
"defaultState": "closed",
"openCmd": "START",
"closeCmd": "STOP",
"toggleCmd": "toggle",
"defaultCmd": "default",
"statusCmd": "status",
"persist": false,
"storeName": "memory",
"x": 790,
"y": 260,
"wires": [
[
"d49eb0060c02fd95"
]
]
},
{
"id": "00ee66b796406c51",
"type": "ui_button",
"z": "3d7d17a620f1054b",
"name": "",
"group": "a9a3a39916ea4f91",
"order": 40,
"width": 2,
"height": 1,
"passthru": false,
"label": "START LOG",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "START",
"payloadType": "str",
"topic": "control",
"topicType": "str",
"x": 570,
"y": 300,
"wires": [
[
"d0f92babef87e3cf"
]
]
},
{
"id": "8690270298b6ed13",
"type": "ui_button",
"z": "3d7d17a620f1054b",
"name": "",
"group": "a9a3a39916ea4f91",
"order": 45,
"width": 2,
"height": 1,
"passthru": false,
"label": "STOP LOG",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "STOP",
"payloadType": "str",
"topic": "control",
"topicType": "str",
"x": 570,
"y": 340,
"wires": [
[
"d0f92babef87e3cf"
]
]
},
{
"id": "fb1bfaca77e0954a",
"type": "inject",
"z": "3d7d17a620f1054b",
"name": "Log rate 5sec interval",
"props": [
{
"p": "payload"
}
],
"repeat": "5",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"payload": "true",
"payloadType": "bool",
"x": 360,
"y": 260,
"wires": [
[
"27f2ba6bc9cd4809"
]
]
},
{
"id": "d49eb0060c02fd95",
"type": "debug",
"z": "3d7d17a620f1054b",
"name": "debug 319",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 950,
"y": 260,
"wires": []
},
{
"id": "a9a3a39916ea4f91",
"type": "ui_group",
"name": "",
"tab": "6ebca4f8bdecdb95",
"order": 1,
"disp": true,
"width": 28,
"collapse": false,
"className": ""
},
{
"id": "6ebca4f8bdecdb95",
"type": "ui_tab",
"name": "WP1",
"icon": "dashboard",
"order": 14,
"disabled": false,
"hidden": false
}
]