[
{
"id": "ccc1360c184b413a",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": ""
},
{
"id": "27e7326f70e90168",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_5",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "dc095a4c1ca3d0be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 160,
"wires": [
[
"d3c328a720ac9183"
],
[]
]
},
{
"id": "d3c328a720ac9183",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 160,
"wires": [
[
"b8a8b938b055144f",
"4b59511b9bd61ba9"
]
]
},
{
"id": "c3b18d970f8f2680",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_4",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "2692a71fc2f3a35f",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 320,
"wires": [
[
"2ada03208d088f9f"
],
[]
]
},
{
"id": "2ada03208d088f9f",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 320,
"wires": [
[
"6f58c147eaff54f5",
"4b59511b9bd61ba9"
]
]
},
{
"id": "b8a8b938b055144f",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 780,
"y": 120,
"wires": []
},
{
"id": "6f58c147eaff54f5",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 750,
"y": 320,
"wires": []
},
{
"id": "4b59511b9bd61ba9",
"type": "join",
"z": "ccc1360c184b413a",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 480,
"y": 520,
"wires": [
[
"c141588faab3021b",
"250b15f56d4ccbbd"
]
]
},
{
"id": "c141588faab3021b",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 730,
"y": 400,
"wires": []
},
{
"id": "8e9d7ef5c3fcdf2a",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 940,
"y": 520,
"wires": []
},
{
"id": "250b15f56d4ccbbd",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$sum(array)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 520,
"wires": [
[
"8e9d7ef5c3fcdf2a"
]
]
},
{
"id": "dc095a4c1ca3d0be",
"type": "modbus-client",
"name": "LOCATION_5",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.123",
"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
},
{
"id": "2692a71fc2f3a35f",
"type": "modbus-client",
"name": "LOCATION_4",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.145",
"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
}
]
You may need to include just a bit more information on what you are wanting to do.
All I see is a message contents displayed. (Guessing)
But not what you are trying to add.
Ok sorry.
But maybe a walk through to help people understand what you are doing.
What are you seeing in the debug
nodes?
Using foreign nodes in your examples is not helpful as others may not have those nodes.
Rather it would be better to make dummy nodes (inject
and change
) to construct the message/s you are receiving and then others can see what it is you are getting.
P.S.
It would seem you are adding the values in the change
node: it won't work.
All variables are valid only at the time of them being sent.
If you want to add the value of one input to the value of another (which you haven't really explained) the second set of values won't exist.
But again:
You haven't explained enough what it is and what you are seeing.
Please put in the nodes as suggested above with the inject
and change
to make the messages and repost the code.
[
{
"id": "ccc1360c184b413a",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": ""
},
{
"id": "27e7326f70e90168",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_5",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "dc095a4c1ca3d0be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 160,
"wires": [
[
"d3c328a720ac9183"
],
[]
]
},
{
"id": "d3c328a720ac9183",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 160,
"wires": [
[
"812cfffb8fad5391"
]
]
},
{
"id": "c3b18d970f8f2680",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_4",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "2692a71fc2f3a35f",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 320,
"wires": [
[
"2ada03208d088f9f"
],
[]
]
},
{
"id": "2ada03208d088f9f",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 320,
"wires": [
[
"de59d139359235a0"
]
]
},
{
"id": "812cfffb8fad5391",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v1",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 575,
"y": 77,
"wires": [
[
"0ea204ed95afb028"
]
]
},
{
"id": "de59d139359235a0",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v2",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 240,
"wires": [
[
"0ea204ed95afb028"
]
]
},
{
"id": "0ea204ed95afb028",
"type": "change",
"z": "ccc1360c184b413a",
"name": "sum",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$number($flowContext('v1')) + $number($flowContext('v2')) + $number($flowContext('v3'))",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 728,
"y": 180,
"wires": [
[
"aa3809a6d2a20046"
]
]
},
{
"id": "9377623d8ccca450",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "AIRPORT",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "6b455b808110be31",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 160,
"y": 460,
"wires": [
[
"25681a0bc899f589"
],
[]
]
},
{
"id": "25681a0bc899f589",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 460,
"wires": [
[
"17a6979a6d639802"
]
]
},
{
"id": "17a6979a6d639802",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v3",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 597,
"y": 378,
"wires": [
[
"0ea204ed95afb028",
"51aff0b66a93d412"
]
]
},
{
"id": "51aff0b66a93d412",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 831,
"y": 400,
"wires": []
},
{
"id": "aa3809a6d2a20046",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 897,
"y": 281,
"wires": []
},
{
"id": "dc095a4c1ca3d0be",
"type": "modbus-client",
"name": "LOCATION_5",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.123",
"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
},
{
"id": "2692a71fc2f3a35f",
"type": "modbus-client",
"name": "LOCATION_4",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.145",
"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
},
{
"id": "6b455b808110be31",
"type": "modbus-client",
"name": "AIRPORT",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.133",
"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
}
][quote="Trying_to_learn, post:2, topic:62348, full:true"]
You may need to include just a bit more information on what you are wanting to do.
~~All I see is a message contents displayed. (Guessing)~~
~~But not what you are trying to add.~~
Ok sorry.
But maybe a *walk through* to help people understand what you are doing.
What are you seeing in the `debug` nodes?
Using *foreign* nodes in your examples is not helpful as others may not have those nodes.
Rather it would be better to make *dummy* nodes (`inject` and `change`) to construct the message/s you are receiving and then others can see what it is you are getting.
P.S.
It would seem you are adding the values in the `change` node: it won't work.
All variables are valid only at the time of them being sent.
If you want to add the value of one input to the value of another (which you haven't really explained) the second set of values won't exist.
But again:
You haven't explained enough what it is and what you are seeing.
Please put in the nodes as suggested above with the `inject` and `change` to make the messages and repost the code.
[/quote]
actually i am using three different IP Modbus values addition but unfortunately when any one data is not coming then its showing error message.
[quote="jitesh, post:3, topic:62348, full:true"]
[
{
"id": "ccc1360c184b413a",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": ""
},
{
"id": "27e7326f70e90168",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_5",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "dc095a4c1ca3d0be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 160,
"wires": [
[
"d3c328a720ac9183"
],
[]
]
},
{
"id": "d3c328a720ac9183",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 160,
"wires": [
[
"812cfffb8fad5391"
]
]
},
{
"id": "c3b18d970f8f2680",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_4",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "2692a71fc2f3a35f",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 320,
"wires": [
[
"2ada03208d088f9f"
],
[]
]
},
{
"id": "2ada03208d088f9f",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 320,
"wires": [
[
"de59d139359235a0"
]
]
},
{
"id": "812cfffb8fad5391",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v1",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 575,
"y": 77,
"wires": [
[
"0ea204ed95afb028"
]
]
},
{
"id": "de59d139359235a0",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v2",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 240,
"wires": [
[
"0ea204ed95afb028"
]
]
},
{
"id": "0ea204ed95afb028",
"type": "change",
"z": "ccc1360c184b413a",
"name": "sum",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$number($flowContext('v1')) + $number($flowContext('v2')) + $number($flowContext('v3'))",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 728,
"y": 180,
"wires": [
[
"aa3809a6d2a20046"
]
]
},
{
"id": "9377623d8ccca450",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "AIRPORT",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "6b455b808110be31",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 160,
"y": 460,
"wires": [
[
"25681a0bc899f589"
],
[]
]
},
{
"id": "25681a0bc899f589",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 460,
"wires": [
[
"17a6979a6d639802"
]
]
},
{
"id": "17a6979a6d639802",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "v3",
"pt": "flow",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 597,
"y": 378,
"wires": [
[
"0ea204ed95afb028",
"51aff0b66a93d412"
]
]
},
{
"id": "51aff0b66a93d412",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 831,
"y": 400,
"wires": []
},
{
"id": "aa3809a6d2a20046",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 897,
"y": 281,
"wires": []
},
{
"id": "dc095a4c1ca3d0be",
"type": "modbus-client",
"name": "LOCATION_5",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.123",
"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
},
{
"id": "2692a71fc2f3a35f",
"type": "modbus-client",
"name": "LOCATION_4",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.145",
"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
},
{
"id": "6b455b808110be31",
"type": "modbus-client",
"name": "AIRPORT",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.133",
"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
}
]
actually i am using three different IP Modbus values addition but unfortunately when any one data is not coming then its showing error message.
please check the image also
What is this? I can't import it.
And what are those orange nodes at the left of the flow?
CT-5
CT-4
AIRPORT
It looks like they are Modbus nodes.
Modbus
Your third modbus does not have any value - that's why you get undefined.
If you use a function node you can check before adding.
Alternatively, you can avoid using context altogether and use a join node set for a count of 3.
But.... (Playing devil's advocate)
If all three (different) messages get out of sync: it will play havoc on the output value.
Sorry... But it could happen.
Since the op is simply adding, it doesn't matter what order the values come in. However, to avoid that never use array mode. Instead, use the key value mode and the variables no matter what order they arrive will always be in the same key.
Sorry.. Really. Sorry.
Sir please share any example when 3 data will add and one of them showing undefined value.
please sir........thanks in advance
Sir please share any example when 3 data will add and one of them showing undefined value.
please sir........thanks in advance[quote="jitesh, post:1, topic:62348, full:true"]
[
{
"id": "ccc1360c184b413a",
"type": "tab",
"label": "Flow 5",
"disabled": false,
"info": ""
},
{
"id": "27e7326f70e90168",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_5",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "dc095a4c1ca3d0be",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 160,
"wires": [
[
"d3c328a720ac9183"
],
[]
]
},
{
"id": "d3c328a720ac9183",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 440,
"y": 160,
"wires": [
[
"b8a8b938b055144f",
"4b59511b9bd61ba9"
]
]
},
{
"id": "c3b18d970f8f2680",
"type": "modbus-read",
"z": "ccc1360c184b413a",
"name": "CT_4",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "100",
"quantity": "60",
"rate": "1",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "2692a71fc2f3a35f",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 210,
"y": 320,
"wires": [
[
"2ada03208d088f9f"
],
[]
]
},
{
"id": "2ada03208d088f9f",
"type": "function",
"z": "ccc1360c184b413a",
"name": "",
"func": "msg.payload = [msg.payload[4],msg.payload[3]];\nlet pay = msg.payload;\n\nconst buf = Buffer.allocUnsafe(4);\nbuf.writeUInt16BE(pay[0],2);\nbuf.writeUInt16BE(pay[1],0);\n\nmsg.payload = buf.readFloatBE(0).toFixed(2);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 320,
"wires": [
[
"6f58c147eaff54f5",
"4b59511b9bd61ba9"
]
]
},
{
"id": "b8a8b938b055144f",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 780,
"y": 120,
"wires": []
},
{
"id": "6f58c147eaff54f5",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 750,
"y": 320,
"wires": []
},
{
"id": "4b59511b9bd61ba9",
"type": "join",
"z": "ccc1360c184b413a",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 480,
"y": 520,
"wires": [
[
"c141588faab3021b",
"250b15f56d4ccbbd"
]
]
},
{
"id": "c141588faab3021b",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 730,
"y": 400,
"wires": []
},
{
"id": "8e9d7ef5c3fcdf2a",
"type": "debug",
"z": "ccc1360c184b413a",
"name": "",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": true,
"complete": "payload",
"targetType": "msg",
"statusVal": "payload",
"statusType": "auto",
"x": 940,
"y": 520,
"wires": []
},
{
"id": "250b15f56d4ccbbd",
"type": "change",
"z": "ccc1360c184b413a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "$sum(array)\t",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 700,
"y": 520,
"wires": [
[
"8e9d7ef5c3fcdf2a"
]
]
},
{
"id": "dc095a4c1ca3d0be",
"type": "modbus-client",
"name": "LOCATION_5",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.123",
"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
},
{
"id": "2692a71fc2f3a35f",
"type": "modbus-client",
"name": "LOCATION_4",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "103.62.95.145",
"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
}
]
[/quote]
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.