IOT2050+MX300+Sensor


Hello

Please I need help...
I am trying to reach data from my Sensor but I am not getting it unfortunatelyy with Node -Red
At the beginning it was working then after to many time of running i am getting only errors maybe it hqas to do with to many Modbus Nodes that are Modbus RTU basiert

Don't try and run multiple modbus nodes in parallel.
First, if you are fetching multiple registers from one device then attempt to do it by using a read across a larger number of registers and using just the bits you need (node-red-contrib-buffer-parser is the node to use for that).
For any remaining access, run the modbus nodes in series, so do the first one, then when that is complete trigger the second and so on.

Hello
Thnx for the help,
Can u give me a possible json code to try on my node red flow please ?

How many devices have you got, and what registers are you trying to read?

I have only one Modbus Master IOT2050 und one Modbus Slave MX300 which takes temperature data from sensor TH300.....I need to read the register 3000 and to write on the register 3065 later i have to read on the addresse 3254 63 registers

In that case why have you got so many modbus nodes? You only need three. One to read 3000, one to write 3065 and another to read 63 registers from 3254. Use modbus Getter or Flex-Getter nodes.

Because I have to read 3000 time after time and to write on 3065 each time sth new at the end I have to read 3254 for the result

Sorry, I don't understand.

[
{
"id": "11875115745664cc",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "Anfrage an MX300 starting von 3000 ob er bereit ist mir Daten auszuliefern? ",
"topic": "",
"showStatusActivities": true,
"logIOActivities": false,
"showErrors": true,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3000",
"quantity": "4",
"rate": "5",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "10",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1070,
"y": 120,
"wires": [
[
"23dbb76084f22132"
],
[
"5ac55c882a59266b"
]
]
},
{
"id": "a73615138199b2bc",
"type": "modbus-write",
"z": "680e319aa9bedf34",
"name": "Anfrage an MX300 ",
"showStatusActivities": true,
"showErrors": true,
"unitid": "",
"dataType": "MHoldingRegisters",
"adr": "3065",
"quantity": "4",
"server": "7c812aed.2d3a44",
"emptyMsgOnFail": true,
"keepMsgProperties": true,
"x": 1650,
"y": 140,
"wires": [
[
"b8f5b0cdc84b3588"
],
[
"4eb24154348a6b15"
]
]
},
{
"id": "b8f5b0cdc84b3588",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "Modbus Response",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1890,
"y": 100,
"wires":
},
{
"id": "5ac55c882a59266b",
"type": "function",
"z": "680e319aa9bedf34",
"name": "",
"func": "// Enter the values you want to write to the registers as a string\nvar valuesString = "002A 13D8 82CD 0100";\n\n// Convert the string to an array of bytes\nvar valuesArray = valuesString.split(' ').map(function(hex) {\n return parseInt(hex, 16);\n});\n\n// Set the message payload to the values array\nmsg.payload = valuesArray;\n\n// Return the message object\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 1460,
"y": 140,
"wires": [
[
"a73615138199b2bc"
]
]
},
{
"id": "4eb24154348a6b15",
"type": "modbus-response",
"z": "680e319aa9bedf34",
"name": "",
"registerShowMax": 20,
"x": 1890,
"y": 160,
"wires":
},
{
"id": "23dbb76084f22132",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1450,
"y": 20,
"wires":
},
{
"id": "25738b27f2cc95a4",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3254",
"quantity": "63",
"rate": "12",
"rateUnit": "s",
"delayOnStart": true,
"startDelayTime": "12",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1090,
"y": 240,
"wires": [
[
"df814fc93a261dcb"
],

]
},
{
"id": "df814fc93a261dcb",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1450,
"y": 280,
"wires":
},
{
"id": "b0db4fe645e53467",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3000",
"quantity": "1",
"rate": "14",
"rateUnit": "s",
"delayOnStart": true,
"startDelayTime": "13",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1010,
"y": 400,
"wires": [
[
"64ea6aed9f88b96d"
],
[
"62dcd46952e5a9c0"
]
]
},
{
"id": "64ea6aed9f88b96d",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1220,
"y": 360,
"wires":
},
{
"id": "62dcd46952e5a9c0",
"type": "function",
"z": "680e319aa9bedf34",
"name": "",
"func": "// Enter the values you want to write to the registers as a string\nvar valuesString = "0000 0000 0000 0000";\n\n// Convert the string to an array of bytes\nvar valuesArray = valuesString.split(' ').map(function(hex) {\n return parseInt(hex, 16);\n});\n\n// Set the message payload to the values array\nmsg.payload = valuesArray;\n\n// Return the message object\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 1220,
"y": 440,
"wires": [
[
"b7d0e79c5682cebc"
]
]
},
{
"id": "b7d0e79c5682cebc",
"type": "modbus-write",
"z": "680e319aa9bedf34",
"name": "",
"showStatusActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "MHoldingRegisters",
"adr": "3065",
"quantity": "4",
"server": "7c812aed.2d3a44",
"emptyMsgOnFail": false,
"keepMsgProperties": false,
"x": 1440,
"y": 440,
"wires": [
[
"af00dfdf4ccb25bc"
],
[
"c1fa7bb888f8bfda"
]
]
},
{
"id": "c1fa7bb888f8bfda",
"type": "modbus-response",
"z": "680e319aa9bedf34",
"name": "",
"registerShowMax": 20,
"x": 1690,
"y": 440,
"wires":
},
{
"id": "af00dfdf4ccb25bc",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1670,
"y": 400,
"wires":
},
{
"id": "30e3b4efe1e95291",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3000",
"quantity": "1",
"rate": "16",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1330,
"y": 540,
"wires": [
[
"199fa9322fb381df"
],

]
},
{
"id": "199fa9322fb381df",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1530,
"y": 540,
"wires":
},
{
"id": "579338d1ef80e6fd",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3001",
"quantity": "1",
"rate": "18",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1510,
"y": 620,
"wires": [
[
"6a9d4dc1e492f456"
],

]
},
{
"id": "6a9d4dc1e492f456",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1730,
"y": 620,
"wires":
},
{
"id": "1d2cf1a8178a36a7",
"type": "modbus-read",
"z": "680e319aa9bedf34",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "3254",
"quantity": "63",
"rate": "20",
"rateUnit": "s",
"delayOnStart": false,
"startDelayTime": "",
"server": "7c812aed.2d3a44",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 1140,
"y": 760,
"wires": [
[
"232d849a67052a46"
],
[
"5bf58bce144dda80"
]
]
},
{
"id": "232d849a67052a46",
"type": "debug",
"z": "680e319aa9bedf34",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1350,
"y": 700,
"wires":
},
{
"id": "c3b8244f9006fb18",
"type": "comment",
"z": "680e319aa9bedf34",
"name": "Command 0- Read Unique Identifier",
"info": "",
"x": 1600,
"y": 700,
"wires":
},
{
"id": "5bf58bce144dda80",
"type": "function",
"z": "680e319aa9bedf34",
"name": "Extract Device ID",
"func": "var payload = msg.payload;\n\nfunction extractDeviceID(payload) {\n // Extract the hexadecimal values D8, 82, and CD\n const hexValues = payload.slice(8, 11);\n\n // Convert the hexadecimal values to a single string\n const hexString = hexValues.map(value => value.toString(16).padStart(2, '0')).join('');\n\n // Convert the hexadecimal string to decimal\n const deviceID = parseInt(hexString, 16);\n\n return deviceID;\n}\n\nvar deviceID = extractDeviceID(payload);\n\nmsg.payload = deviceID;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 1370,
"y": 760,
"wires": [
[
"9c43147feddc3ce7"
]
]
},
{
"id": "9c43147feddc3ce7",
"type": "ui_text",
"z": "680e319aa9bedf34",
"group": "4db92a27794b5b69",
"order": 1,
"width": "3",
"height": "1",
"name": "Device ID",
"label": "Device ID",
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 1580,
"y": 760,
"wires":
},
{
"id": "7c812aed.2d3a44",
"type": "modbus-client",
"z": "680e319aa9bedf34",
"name": "iot2050 advanced configuration",
"clienttype": "serial",
"bufferCommands": true,
"stateLogEnabled": true,
"queueLogEnabled": true,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyUSB0",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "19200",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "even",
"serialConnectionDelay": "100",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "1000",
"parallelUnitIdsAllowed": true
},
{
"id": "4db92a27794b5b69",
"type": "ui_group",
"name": "Default",
"tab": "6137db660c8932e6",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "6137db660c8932e6",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"order": 1
}
]

here is the json code....can u take a look please ??

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

But the flow is not what I asked for. Please explain in words what you need to do.


The main Idea is to take temperature information from the sensor TH300....For that I need to send a request on MX300 if he is ready to send me data from the addresse 3000? ! If yes I want to read this data from addresse 3254 ??

My aim is also to see in node red what kind of sensor is that ? which Device ID ?

What is involved in doing that?

How do you know?

What is the problem doing that when you get a Yes reponse?

I get a time out response after I start sending the request that is the point and I got only errors

Have you followed that advice? Using the getter node you have control over when things happen.

[
    {
        "id": "520de09123b399e6",
        "type": "inject",
        "z": "8c0aee693ad7c8f2",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "5",
        "crontab": "",
        "once": true,
        "onceDelay": "10",
        "topic": "",
        "payloadType": "date",
        "x": 150,
        "y": 380,
        "wires": [
            [
                "700a3c938943bf19"
            ]
        ]
    }
]

I tried like that ....I am not getting any error but only after 3254 I cannot see the Modbus Response

Don't use automatic repeat on the inject nodes, at least for the moment, otherwise you may get them both trying to do things at the same time.
Add a debug node showing what is going into the 3254 node (that is what is coming out of the lower function node) and show us how you have configured node 3254. Set the debug node to Output Complete Message