I am trying to figure out how to move forward from where I am at. I can get the modbus registers when I click timestamp. I can not tell exactly which ones are which, these ones should all be read.
Other modbus setups I have dealt with you have to select your read or write, or holding registers.....
I also am trying to get it to read the modbus on a normal interval, not only when I click the timestamp.
One more thing it I need to link the modbus to the ui. I have not been able to figure out how to link a certain value in the array to the UI.
Does anyone have any words of wisdom to point me in the right direction?
Thank you in advance. Here is a screen shot of the flow that I grabbed out of the examples.
[][
{
"id": "652f4e57.e3d538",
"type": "tab",
"label": "Modbus Flex Suite",
"disabled": false,
"info": ""
},
{
"id": "a3b5157.5b448e8",
"type": "catch",
"z": "652f4e57.e3d538",
"name": "",
"scope": null,
"uncaught": false,
"x": 760,
"y": 60,
"wires": [
[
"f4562026.e964e8",
"527faaad.71bfb4",
"3fcea88e.d87c4"
]
]
},
{
"id": "f4562026.e964e8",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"console": "false",
"complete": "true",
"x": 930,
"y": 60,
"wires": []
},
{
"id": "15c06b93.b1bd24",
"type": "modbus-queue-info",
"z": "652f4e57.e3d538",
"name": "Modbus Local Read Client Queue",
"topic": "",
"unitid": "1",
"queueReadIntervalTime": "1000",
"lowLowLevel": 25,
"lowLevel": 75,
"highLevel": 150,
"highHighLevel": 300,
"server": "fa873ff5.42afa",
"errorOnHighLevel": false,
"showStatusActivities": false,
"updateOnAllQueueChanges": false,
"updateOnAllUnitQueues": false,
"x": 1520,
"y": 120,
"wires": [
[
"414c8e91.3579"
]
]
},
{
"id": "b6ec7b66.431b9",
"type": "function",
"z": "652f4e57.e3d538",
"name": "reset on High",
"func": "if(\"high level reached\" === msg.state) {\n msg.resetQueue = true;\n}\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1230,
"y": 100,
"wires": [
[
"15c06b93.b1bd24"
]
]
},
{
"id": "6a69f701.a84ee",
"type": "function",
"z": "652f4e57.e3d538",
"name": "reset on HighHigh",
"func": "if(\"high high level reached\" === msg.state) {\n msg.resetQueue = true;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1250,
"y": 140,
"wires": [
[
"15c06b93.b1bd24"
]
]
},
{
"id": "414c8e91.3579",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1730,
"y": 120,
"wires": []
},
{
"id": "527faaad.71bfb4",
"type": "switch",
"z": "652f4e57.e3d538",
"name": "Modbus Local Read Client",
"property": "modbusClientName",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Modbus Local Read Client",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 1000,
"y": 120,
"wires": [
[
"6a69f701.a84ee",
"b6ec7b66.431b9"
]
]
},
{
"id": "9f2fea52.eaa4a8",
"type": "modbus-queue-info",
"z": "652f4e57.e3d538",
"name": "Modbus Local Write Client Queue",
"topic": "",
"unitid": "1",
"queueReadIntervalTime": "1000",
"lowLowLevel": 25,
"lowLevel": 75,
"highLevel": 150,
"highHighLevel": 300,
"server": "883d0976.8296d",
"errorOnHighLevel": false,
"showStatusActivities": false,
"updateOnAllQueueChanges": false,
"updateOnAllUnitQueues": false,
"x": 1520,
"y": 200,
"wires": [
[
"c4986456.111ab8"
]
]
},
{
"id": "4e72b028.97c058",
"type": "function",
"z": "652f4e57.e3d538",
"name": "reset on High",
"func": "if(\"high level reached\" === msg.state) {\n msg.resetQueue = true;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1230,
"y": 180,
"wires": [
[
"9f2fea52.eaa4a8"
]
]
},
{
"id": "f7bed91f.92e3b",
"type": "function",
"z": "652f4e57.e3d538",
"name": "reset on HighHigh",
"func": "if(\"high high level reached\" === msg.state) {\n msg.resetQueue = true;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1250,
"y": 220,
"wires": [
[
"9f2fea52.eaa4a8"
]
]
},
{
"id": "c4986456.111ab8",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"console": "false",
"complete": "true",
"x": 1730,
"y": 200,
"wires": []
},
{
"id": "3fcea88e.d87c4",
"type": "switch",
"z": "652f4e57.e3d538",
"name": "Modbus Local Write Client",
"property": "modbusClientName",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Modbus Local Write Client",
"vt": "str"
}
],
"checkall": "true",
"outputs": 1,
"x": 1000,
"y": 200,
"wires": [
[
"f7bed91f.92e3b",
"4e72b028.97c058"
]
]
},
{
"id": "e14e3869.eb3a5",
"type": "modbus-flex-getter",
"z": "652f4e57.e3d538",
"name": "Modbus Flexible Read",
"showStatusActivities": false,
"showErrors": true,
"showWarnings": true,
"logIOActivities": false,
"server": "fa873ff5.42afa",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"delayOnStart": false,
"enableDeformedMessages": false,
"startDelayTime": "",
"x": 520,
"y": 400,
"wires": [
[
"ff88bff3.9f8ff",
"6f54a366.20bebc",
"ade16e02.cb6d18"
],
[
"f3f1b052.baf858",
"fa9a0149.27dc7"
]
]
},
{
"id": "2eea6853.20c25",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 340,
"wires": [
[
"e38a7a4f.8c2f48"
]
]
},
{
"id": "e38a7a4f.8c2f48",
"type": "function",
"z": "652f4e57.e3d538",
"name": "FC1",
"func": "msg.payload = { 'fc': 1, 'unitid': 1, 'address': 0 , 'quantity': 20 }\nreturn msg;",
"outputs": 1,
"timeout": "30",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 340,
"wires": [
[
"e14e3869.eb3a5"
]
]
},
{
"id": "ff88bff3.9f8ff",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 770,
"y": 300,
"wires": []
},
{
"id": "f3f1b052.baf858",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 750,
"y": 440,
"wires": []
},
{
"id": "fa9a0149.27dc7",
"type": "modbus-response",
"z": "652f4e57.e3d538",
"name": "GARAGE READ",
"registerShowMax": "20",
"x": 780,
"y": 480,
"wires": []
},
{
"id": "ade16e02.cb6d18",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 750,
"y": 380,
"wires": []
},
{
"id": "6f54a366.20bebc",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "responseBuffer",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 800,
"y": 340,
"wires": []
},
{
"id": "8ed3e78.4db9a98",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 380,
"wires": [
[
"de331f5c.d08768"
]
]
},
{
"id": "de331f5c.d08768",
"type": "function",
"z": "652f4e57.e3d538",
"name": "FC2",
"func": "msg.payload = { 'fc': 2, 'unitid': 1, 'address': 0 , 'quantity': 8 }\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 380,
"wires": [
[
"e14e3869.eb3a5"
]
]
},
{
"id": "3c4efee.7c84982",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 420,
"wires": [
[
"ef723150.a5224"
]
]
},
{
"id": "ef723150.a5224",
"type": "function",
"z": "652f4e57.e3d538",
"name": "FC3",
"func": "msg.payload = { 'fc': 3, 'unitid': 1, 'address': 0 , 'quantity': 8 }\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 420,
"wires": [
[
"e14e3869.eb3a5"
]
]
},
{
"id": "f370e948.f19418",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 460,
"wires": [
[
"ac2f1711.01ace"
]
]
},
{
"id": "ac2f1711.01ace",
"type": "function",
"z": "652f4e57.e3d538",
"name": "FC4",
"func": "msg.payload = { 'fc': 4, 'unitid': 1, 'address': 0 , 'quantity': 10 }\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 290,
"y": 460,
"wires": [
[
"e14e3869.eb3a5"
]
]
},
{
"id": "ecb9178e.9920e",
"type": "modbus-flex-write",
"z": "652f4e57.e3d538",
"name": "Modbus Flexible Write",
"showStatusActivities": false,
"showErrors": true,
"showWarnings": true,
"server": "883d0976.8296d",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"delayOnStart": false,
"startDelayTime": "",
"x": 1540,
"y": 380,
"wires": [
[
"734d823a.4838ec",
"4cdfafbd.8287c",
"209706a5.f36202"
],
[
"9e2e2512.eec7a8",
"46369521.c482b4"
]
]
},
{
"id": "734d823a.4838ec",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": true,
"console": "false",
"complete": "payload",
"x": 1770,
"y": 280,
"wires": []
},
{
"id": "9e2e2512.eec7a8",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"console": "false",
"complete": "true",
"x": 1750,
"y": 420,
"wires": []
},
{
"id": "46369521.c482b4",
"type": "modbus-response",
"z": "652f4e57.e3d538",
"name": "",
"registerShowMax": 20,
"x": 1790,
"y": 460,
"wires": []
},
{
"id": "209706a5.f36202",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"console": "false",
"complete": "true",
"x": 1750,
"y": 360,
"wires": []
},
{
"id": "4cdfafbd.8287c",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": false,
"console": "false",
"complete": "responseBuffer",
"x": 1800,
"y": 320,
"wires": []
},
{
"id": "5520a02e.18592",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1100,
"y": 320,
"wires": [
[
"a51c8357.9ac0c"
]
]
},
{
"id": "a51c8357.9ac0c",
"type": "function",
"z": "652f4e57.e3d538",
"name": "Random 10 FC16",
"func": "let values = [\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1,\n Math.random() * (65000 - 1) + 1\n]\nmsg.payload = { 'value': values, 'fc': 16, 'unitid': 1, 'address': 0 , 'quantity': 10 }\nreturn msg;",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1290,
"y": 320,
"wires": [
[
"ecb9178e.9920e"
]
]
},
{
"id": "1200bb7e.c6d265",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1100,
"y": 360,
"wires": [
[
"a672caf3.0351"
]
]
},
{
"id": "a672caf3.0351",
"type": "function",
"z": "652f4e57.e3d538",
"name": "Random 10 FC15",
"func": "let values = [\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2,\n parseInt(Math.random() * (65000 - 1) + 1) % 2 \n]\nmsg.payload = { 'value': values, 'fc': 15, 'unitid': 1, 'address': 0 , 'quantity': 10 }\nreturn msg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1290,
"y": 360,
"wires": [
[
"ecb9178e.9920e"
]
]
},
{
"id": "cbdcdf7c.3fccf8",
"type": "comment",
"z": "652f4e57.e3d538",
"name": "Flexible Read and Write",
"info": "",
"x": 160,
"y": 280,
"wires": []
},
{
"id": "c1b52524.e78b4",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1100,
"y": 400,
"wires": [
[
"372a573f.d4f28"
]
]
},
{
"id": "372a573f.d4f28",
"type": "function",
"z": "652f4e57.e3d538",
"name": "Random FC 6",
"func": "let values = Math.random() * (65000 - 1) + 1\nmsg.payload = { 'value': values, 'fc': 6, 'unitid': 1, 'address': 0 , 'quantity': 1 }\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 1300,
"y": 400,
"wires": [
[
"ecb9178e.9920e"
]
]
},
{
"id": "8ff75dfe.fb5808",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "date",
"x": 1100,
"y": 440,
"wires": [
[
"d91b7970.2a5c9"
]
]
},
{
"id": "d91b7970.2a5c9",
"type": "function",
"z": "652f4e57.e3d538",
"name": "Random FC 5",
"func": "let values = parseInt(Math.random() * (65000 - 1) + 1) % 2\nmsg.payload = { value: values, 'fc': 5, 'unitid': 1, 'address': 0 , 'quantity': 10 }\nreturn msg",
"outputs": 1,
"noerr": 0,
"x": 1300,
"y": 440,
"wires": [
[
"ecb9178e.9920e"
]
]
},
{
"id": "9a2ec8a68dddbabc",
"type": "debug",
"z": "652f4e57.e3d538",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 570,
"y": 120,
"wires": []
},
{
"id": "79a3d0e6a887ac09",
"type": "inject",
"z": "652f4e57.e3d538",
"name": "",
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 160,
"y": 120,
"wires": [
[
"2f40754d0ba69b73"
]
]
},
{
"id": "2f40754d0ba69b73",
"type": "modbus-flex-server",
"z": "652f4e57.e3d538",
"name": "Garage",
"logEnabled": false,
"serverAddress": "192.168.40.240",
"serverPort": "502",
"responseDelay": "10",
"unitId": 1,
"delayUnit": "s",
"coilsBufferSize": "50",
"registersBufferSize": "50",
"minAddress": 0,
"splitAddress": "200",
"funcGetCoil": "function getFlexCoil(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t} \n}",
"funcGetDiscreteInput": "function getFlexDiscreteInput(addr, unitID) {\n\tif (unitID === node.unitId && \n\t\taddr > node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.coils.readUInt8(addr * node.bufferFactor) \n\t} \n}",
"funcGetInputRegister": "function getFlexInputRegister(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor) \n\t} \n}",
"funcGetHoldingRegister": "function getFlexHoldingRegsiter(addr, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr > node.splitAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\treturn node.registers.readUInt16BE(addr * node.bufferFactor) \n\t} \n}",
"funcSetCoil": "function setFlexCoil(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress) { \n\n\t\tnode.coils.writeUInt8(value, addr * node.bufferFactor) \n\t} \n}",
"funcSetRegister": "function setFlexRegister(addr, value, unitID) { \n\tif (unitID === node.unitId && \n\t\taddr >= node.minAddress && \n\t\taddr <= node.splitAddress * 2) { \n\n\t\tnode.registers.writeUInt16BE(value, addr * node.bufferFactor) \n\t} \n}",
"showErrors": false,
"x": 320,
"y": 120,
"wires": [
[
"9a2ec8a68dddbabc"
],
[
"9a2ec8a68dddbabc"
],
[
"9a2ec8a68dddbabc"
],
[
"9a2ec8a68dddbabc"
],
[]
]
},
{
"id": "a69f1b395b571a43",
"type": "comment",
"z": "652f4e57.e3d538",
"name": "Server for Modbus Flex Suite Flow",
"info": "needs node-red-contrib-modbus-flex-server package",
"x": 240,
"y": 60,
"wires": []
},
{
"id": "fa873ff5.42afa",
"type": "modbus-client",
"z": "652f4e57.e3d538",
"name": "Modbus Local Read Client",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": false,
"tcpHost": "192.168.40.240",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "",
"unit_id": 1,
"commandDelay": 1,
"clientTimeout": 1000,
"reconnectOnTimeout": true,
"reconnectTimeout": 2000,
"parallelUnitIdsAllowed": false,
"showErrors": false,
"showWarnings": true,
"showLogs": true
},
{
"id": "883d0976.8296d",
"type": "modbus-client",
"z": "652f4e57.e3d538",
"name": "Modbus Local Write Client",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"failureLogEnabled": false,
"tcpHost": "192.168.40.240",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"serialAsciiResponseStartDelimiter": "",
"unit_id": 1,
"commandDelay": 1,
"clientTimeout": 1000,
"reconnectOnTimeout": true,
"reconnectTimeout": 2000,
"parallelUnitIdsAllowed": false,
"showErrors": false,
"showWarnings": true,
"showLogs": true
},
{
"id": "c3b91bd7a63ad874",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-modbus": "5.45.2",
"node-red-contrib-modbus-flex-server": "1.0.1"
}
}
]
