Hi
Can you just send me the part with the register values. The Json file seems to have Javascript code jumbled with it.
Just copy the buffer values from the debug node.
Rgds
Steve
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
Cookie
Duration
Description
cookielawinfo-checkbox-analytics
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional
11 months
The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance
11 months
This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy
11 months
The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Hello Steve,
I am new to Node Red & trying to get the data from a gas flow meter. The data type is Float. I have tried few methods by searching the Web, Youtube. Here is the json file of the Flow.
The problem is I am not getting the correct value of as in the register of the Modbus contrib read.
The 8 bit buffer from the read data matches the value of the flowmeter register. But when I convert the value is not matching. Please help.
The correct value is 1242298282-32Bit UInt, 2293227 – Float.
Please Weld gas Total
[
{
“id”: “cc95679c3902ed7a”,
“type”: “tab”,
“label”: “Paneling”,
“disabled”: false,
“info”: “”
},
{
“id”: “11b428f717ac8283”,
“type”: “modbus-read”,
“z”: “cc95679c3902ed7a”,
“name”: “WeldGasFlRt”,
“topic”: “”,
“showStatusActivities”: false,
“logIOActivities”: false,
“showErrors”: false,
“unitid”: “1”,
“dataType”: “HoldingRegister”,
“adr”: “3”,
“quantity”: “2”,
“rate”: “1”,
“rateUnit”: “m”,
“delayOnStart”: false,
“startDelayTime”: “”,
“server”: “0fe5f962b71582e1”,
“useIOFile”: false,
“ioFile”: “”,
“useIOForPayload”: false,
“emptyMsgOnFail”: false,
“x”: 130,
“y”: 60,
“wires”: [
[
“0157462b9f7cf4f8”,
“e517639961f7ea91”
],
[]
]
},
{
“id”: “0157462b9f7cf4f8”,
“type”: “modbus-response”,
“z”: “cc95679c3902ed7a”,
“name”: “”,
“registerShowMax”: 20,
“x”: 330,
“y”: 20,
“wires”: []
},
{
“id”: “e517639961f7ea91”,
“type”: “function”,
“z”: “cc95679c3902ed7a”,
“name”: “Convert”,
“func”: “msg.payload = (msg.payload[0]<<16 + msg.payload[1]);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 300,
"y": 80,
"wires": [
[
"68b2a54d6d2251df"
]
]
},
{
"id": "2be7479ff0f1d399",
"type": "modbus-response",
"z": "cc95679c3902ed7a",
"name": "",
"registerShowMax": 20,
"x": 330,
"y": 120,
"wires": []
},
{
"id": "3791f2a088c36ccc",
"type": "modbus-read",
"z": "cc95679c3902ed7a",
"name": "WeldGasFlw",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "1",
"dataType": "HoldingRegister",
"adr": "32",
"quantity": "2",
"rate": "10",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "0fe5f962b71582e1",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 130,
"y": 160,
"wires": [
[
"2be7479ff0f1d399"
],
[
"46410512aaf01603",
"14f1d0cde6873538",
"8c52ba9e407e1941"
]
]
},
{
"id": "bfddfaae38d576b1",
"type": "modbus-response",
"z": "cc95679c3902ed7a",
"name": "",
"registerShowMax": 20,
"x": 330,
"y": 340,
"wires": []
},
{
"id": "75e596045590cdfe",
"type": "modbus-read",
"z": "cc95679c3902ed7a",
"name": "PnlAirFlRt",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "7",
"dataType": "HoldingRegister",
"adr": "33",
"quantity": "2",
"rate": "1",
"rateUnit": "m",
"delayOnStart": false,
"startDelayTime": "",
"server": "5416182ed1fd1208",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 120,
"y": 380,
"wires": [
[
"bfddfaae38d576b1",
"03d62c18b4e27c4f"
],
[]
]
},
{
"id": "03d62c18b4e27c4f",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Convert",
"func": "msg.payload = (msg.payload[0]/10);\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 300,
"y": 400,
"wires": [
[
"56bd67b6eb946b7f",
"d7c6c271fd2f5d4d"
]
]
},
{
"id": "a49f976292e55ad4",
"type": "modbus-response",
"z": "cc95679c3902ed7a",
"name": "",
"registerShowMax": 20,
"x": 330,
"y": 440,
"wires": []
},
{
"id": "f3894060ba13ae0d",
"type": "modbus-read",
"z": "cc95679c3902ed7a",
"name": "PnlAirFlw",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "7",
"dataType": "HoldingRegister",
"adr": "7",
"quantity": "2",
"rate": "5",
"rateUnit": "m",
"delayOnStart": false,
"startDelayTime": "",
"server": "5416182ed1fd1208",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 120,
"y": 480,
"wires": [
[
"a49f976292e55ad4"
],
[
"6d26a8cf5807e20f"
]
]
},
{
"id": "6d26a8cf5807e20f",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Convert",
"func": "const buf = Buffer.from(msg.payload.buffer);\nconst value = buf.readUInt32BE();\nmsg.payload = value;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 300,
"y": 500,
"wires": [
[
"c1f68a78ccb4b58d",
"282120aedb513057"
]
]
},
{
"id": "68b2a54d6d2251df",
"type": "toFloat",
"z": "cc95679c3902ed7a",
"name": "",
"toFixed": "2",
"x": 490,
"y": 80,
"wires": [
[
"e31f2ab61cab6c2c",
"190ccafc55fc1da8"
]
]
},
{
"id": "6689235833f6b38c",
"type": "influxdb out",
"z": "cc95679c3902ed7a",
"influxdb": "fa6f8066b6ecbcbe",
"name": "FlowRate",
"measurement": "WeldGas",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "organisation",
"bucket": "bucket",
"x": 840,
"y": 80,
"wires": []
},
{
"id": "e31f2ab61cab6c2c",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "GasFlRt",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 40,
"wires": []
},
{
"id": "e8022ff8d3348d8a",
"type": "influxdb out",
"z": "cc95679c3902ed7a",
"influxdb": "fa6f8066b6ecbcbe",
"name": "FlowRate",
"measurement": "Panel",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "organisation",
"bucket": "bucket",
"x": 840,
"y": 400,
"wires": []
},
{
"id": "281b70e454a3cae4",
"type": "influxdb out",
"z": "cc95679c3902ed7a",
"influxdb": "01269350df8fd048",
"name": "FlowTotal",
"measurement": "Panel",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "organisation",
"bucket": "bucket",
"x": 840,
"y": 500,
"wires": []
},
{
"id": "56b9b1f3f661b365",
"type": "influxdb out",
"z": "cc95679c3902ed7a",
"influxdb": "01269350df8fd048",
"name": "FlowTotal",
"measurement": "WeldGas",
"precision": "",
"retentionPolicy": "",
"database": "database",
"precisionV18FluxV20": "ms",
"retentionPolicyV18Flux": "",
"org": "organisation",
"bucket": "bucket",
"x": 840,
"y": 140,
"wires": []
},
{
"id": "e61c2b3844e3776b",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "GasFlow-Float",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 240,
"wires": []
},
{
"id": "56bd67b6eb946b7f",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "PnlAirFlRt",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 360,
"wires": []
},
{
"id": "282120aedb513057",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "PnlAirFlw",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 460,
"wires": []
},
{
"id": "190ccafc55fc1da8",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Store",
"func": "msg.payload = {\n data: \"WeldGas\",\n dataval:msg.payload\n };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 80,
"wires": [
[
"6689235833f6b38c"
]
]
},
{
"id": "bb08745cbb0625b7",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Store",
"func": "msg.payload = {\n data: \"WeldGas\",\n dataval:msg.payload\n };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 140,
"wires": [
[
"56b9b1f3f661b365"
]
]
},
{
"id": "c1f68a78ccb4b58d",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Store",
"func": "msg.payload = {\n data: \"Panel\",\n dataval:msg.payload\n };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 500,
"wires": [
[
"281b70e454a3cae4"
]
]
},
{
"id": "d7c6c271fd2f5d4d",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Store",
"func": "msg.payload = {\n data: \"Panel\",\n dataval:msg.payload\n };\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 670,
"y": 400,
"wires": [
[
"e8022ff8d3348d8a"
]
]
},
{
"id": "79c6e520d8431c40",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "Convert1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 200,
"wires": []
},
{
"id": "46410512aaf01603",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Conv1",
"func": "const buf = Buffer.from(msg.payload.buffer);\nvar val1 = buf.readUInt8(0);\nvar val2 = buf.readUInt8(1);\nvar val3 = buf.readUInt8(2);\nvar val4 = buf.readUInt8(3);\nvar Arrayval = [val1,val2,val3,val4];\nmsg.payload = Arrayval;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 200,
"wires": [
[
"79c6e520d8431c40"
]
]
},
{
"id": "8c52ba9e407e1941",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Conv2",
"func": "const buf = Buffer.from(msg.payload.buffer);\nconst value = buf.readFloatBE();\nmsg.payload = value;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 240,
"wires": [
[
"e61c2b3844e3776b"
]
]
},
{
"id": "14f1d0cde6873538",
"type": "function",
"z": "cc95679c3902ed7a",
"name": "Conv3",
"func": "const buf = Buffer.from(msg.payload.buffer);\nconst val1 = buf.readUInt8(0);\nconst val2 = buf.readUInt8(1);\nconst val3 = buf.readUInt8(2);\nconst val4 = buf.readUInt8(3);\nconst array1 = [val1<<8+val2];\nconst array2 = [val3<<8+val4];\nconst array = array2<<16 + array1;\n//const buf1 = array;\n//const value= buf.readFloatBE();\n//msg.payload = value;\nmsg.payload = array;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 330,
"y": 280,
"wires": [
[
"7273c1f3a5752358"
]
]
},
{
"id": "7273c1f3a5752358",
"type": "debug",
"z": "cc95679c3902ed7a",
"name": "conv3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 810,
"y": 280,
"wires": []
},
{
"id": "0fe5f962b71582e1",
"type": "modbus-client",
"name": "Gas",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "172.25.124.5",
"tcpPort": "503",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
},
{
"id": "5416182ed1fd1208",
"type": "modbus-client",
"name": "Panl",
"clienttype": "tcp",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "172.25.124.5",
"tcpPort": "503",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "9600",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"unit_id": "7",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
},
{
"id": "fa6f8066b6ecbcbe",
"type": "influxdb",
"hostname": "localhost",
"port": "8086",
"protocol": "http",
"database": "FlowRate",
"name": "FlowRate",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"rejectUnauthorized": true
},
{
"id": "01269350df8fd048",
"type": "influxdb",
"hostname": "localhost",
"port": "8086",
"protocol": "http",
"database": "FlowCum",
"name": "FlowTotal",
"usetls": false,
"tls": "",
"influxdbVersion": "1.x",
"url": "http://localhost:8086",
"rejectUnauthorized": true
}
]
Hi
Can you just send me the part with the register values. The Json file seems to have Javascript code jumbled with it.
Just copy the buffer values from the debug node.
Rgds
Steve