Skip to content

Instantly share code, notes, and snippets.

@biancode
Created December 30, 2017 20:55
Show Gist options
  • Save biancode/46bfc4fe78cc059a379b383ea445d2d0 to your computer and use it in GitHub Desktop.
Save biancode/46bfc4fe78cc059a379b383ea445d2d0 to your computer and use it in GitHub Desktop.
CODESYS CSV to JSON IO-File for node-red-contrib-modbus
[
{
"id": "c57e318a.a1151",
"type": "tab",
"label": "CODESYS CSV TO JSON",
"disabled": false,
"info": "CODESYS Ethernet CSV export \ntransformation into JSON IO-File"
},
{
"id": "61a19e09.0f7588",
"type": "file in",
"z": "c57e318a.a1151",
"name": "Modbus I/O File devices.csv",
"filename": "/Users/Shared/modbus/device.csv",
"format": "utf8",
"sendError": true,
"x": 340,
"y": 120,
"wires": [
[
"4edfbce9.36a71c"
]
]
},
{
"id": "b65e3939.1bab38",
"type": "inject",
"z": "c57e318a.a1151",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 140,
"y": 120,
"wires": [
[
"61a19e09.0f7588"
]
]
},
{
"id": "4edfbce9.36a71c",
"type": "csv",
"z": "c57e318a.a1151",
"name": "",
"sep": ";",
"hdrin": "",
"hdrout": "",
"multi": "one",
"ret": "\\n",
"temp": "",
"x": 550,
"y": 120,
"wires": [
[
"1f3358e5.8e831f"
]
]
},
{
"id": "dc5bb559.16715",
"type": "debug",
"z": "c57e318a.a1151",
"name": "",
"active": true,
"console": "false",
"complete": "false",
"x": 950,
"y": 80,
"wires": []
},
{
"id": "1f3358e5.8e831f",
"type": "function",
"z": "c57e318a.a1151",
"name": "Filter named Register",
"func": "if(msg.payload.col4 !== undefined && msg.payload.col4.indexOf('//') === -1) {\n var varName = msg.payload.col4;\n var varValue = msg.payload.col5;\n msg.payload = { 'name': varName, 'valueAddress': varValue };\n return msg;\n}\n",
"outputs": 1,
"noerr": 0,
"x": 740,
"y": 120,
"wires": [
[
"dc5bb559.16715",
"184ca746.54f599"
]
]
},
{
"id": "184ca746.54f599",
"type": "file",
"z": "c57e318a.a1151",
"name": "",
"filename": "/Users/Shared/modbus/device.json",
"appendNewline": true,
"createDir": false,
"overwriteFile": "false",
"x": 1020,
"y": 120,
"wires": []
},
{
"id": "6a621cc6.7ce504",
"type": "inject",
"z": "c57e318a.a1151",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 140,
"y": 80,
"wires": [
[
"fb3e32a8.eae588"
]
]
},
{
"id": "fb3e32a8.eae588",
"type": "file",
"z": "c57e318a.a1151",
"name": "",
"filename": "/Users/Shared/modbus/device.json",
"appendNewline": true,
"createDir": false,
"overwriteFile": "delete",
"x": 390,
"y": 80,
"wires": []
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment