MODBUS Mapping Error

I would like to map below mentioned MODBUS registers but getting some errors.

5,4,0,PAT-WAM-01.Clbs/day,FLT32
5,4,2,PAT-WAM-01.COST,$,FLT32
5,4,4,PAT-WAM-01.STATE,,UINT16
5,1,0,PAT-WAM-01.OOS,,boolean

[
    {
        "id": "7f4fc478148cb980",
        "type": "tab",
        "label": "Lanxess",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "e93c3ca6e03cd113",
        "type": "comment",
        "z": "7f4fc478148cb980",
        "name": "Enter username/password",
        "info": "",
        "x": 1330,
        "y": 320,
        "wires": [],
        "icon": "node-red/alert.svg"
    },
    {
        "id": "819ec7545c540f03",
        "type": "modbus-read",
        "z": "7f4fc478148cb980",
        "name": "",
        "topic": "PWI",
        "showStatusActivities": true,
        "logIOActivities": false,
        "showErrors": true,
        "showWarnings": true,
        "unitid": "",
        "dataType": "InputRegister",
        "adr": "30000",
        "quantity": "1",
        "rate": "30",
        "rateUnit": "s",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "b85ab8ebb65ece21",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": true,
        "x": 430,
        "y": 400,
        "wires": [
            [
                "402206c6209b1ddd",
                "057999bda20a1b2b"
            ],
            []
        ]
    },
    {
        "id": "402206c6209b1ddd",
        "type": "debug",
        "z": "7f4fc478148cb980",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "true",
        "targetType": "full",
        "statusVal": "payload[0]",
        "statusType": "auto",
        "x": 670,
        "y": 220,
        "wires": []
    },
    {
        "id": "568dac3c3e1d0bfe",
        "type": "buffer-parser",
        "z": "7f4fc478148cb980",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "floatbe",
                "name": "EMISSIONS",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "keyvalue",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 130,
        "y": 280,
        "wires": [
            [
                "53910b6ec851c498",
                "3f7fb59097d14abc"
            ]
        ]
    },
    {
        "id": "53910b6ec851c498",
        "type": "debug",
        "z": "7f4fc478148cb980",
        "name": "debug 31",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 320,
        "y": 180,
        "wires": []
    },
    {
        "id": "3f7fb59097d14abc",
        "type": "function",
        "z": "7f4fc478148cb980",
        "name": "function 9",
        "func": "let msg2 = {};\nmsg2.payload = {};\nmsg2.payload.channel_1_setpoint_d={};\nmsg2.payload.channel_1_state_d= {};\nmsg2.payload.channel_2_setpoint_d = {};\nmsg2.payload.channel_2_state_d = {};\nmsg2.payload.channel_1_setpoint_d.units = \"True\";\nmsg2.payload.channel_1_setpoint_d.value = msg.payload.channel_1_setpoint_d;\nmsg2.payload.channel_1_state_d.units = \"True\";\nmsg2.payload.channel_1_state_d.value = msg.payload.channel_1_state_d;\nmsg2.payload.channel_2_setpoint_d.units = \"True\";\nmsg2.payload.channel_2_setpoint_d.value = msg.payload.channel_2_setpoint_d;\nmsg2.payload.channel_2_state_d.units = \"True\";\nmsg2.payload.channel_2_state_d.value = msg.payload.channel_2_state_d;\nmsg2.payload.measurement = \"702 DI Transmitters\";\nreturn msg2;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 860,
        "y": 280,
        "wires": [
            [
                "c325f1aeb1af35b2",
                "2a62806cf12686e1"
            ]
        ]
    },
    {
        "id": "c325f1aeb1af35b2",
        "type": "debug",
        "z": "7f4fc478148cb980",
        "name": "debug 32",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1060,
        "y": 420,
        "wires": []
    },
    {
        "id": "057999bda20a1b2b",
        "type": "function",
        "z": "7f4fc478148cb980",
        "name": "function 10",
        "func": "msg.payload.reverse();\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 240,
        "y": 340,
        "wires": [
            [
                "568dac3c3e1d0bfe"
            ]
        ]
    },
    {
        "id": "2a62806cf12686e1",
        "type": "influxdb out",
        "z": "7f4fc478148cb980",
        "influxdb": "f32f037fb43bf103",
        "name": "InfluxDB",
        "measurement": "Emerson_1410S_Gateway",
        "precision": "",
        "retentionPolicy": "",
        "database": "database",
        "precisionV18FluxV20": "ms",
        "retentionPolicyV18Flux": "",
        "org": "organisation",
        "bucket": "bucket",
        "x": 1320,
        "y": 280,
        "wires": []
    },
    {
        "id": "b85ab8ebb65ece21",
        "type": "modbus-client",
        "name": "PWI",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": true,
        "queueLogEnabled": false,
        "failureLogEnabled": true,
        "tcpHost": "10.129.251.134",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "",
        "commandDelay": "1",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true,
        "showWarnings": true,
        "showLogs": true
    },
    {
        "id": "f32f037fb43bf103",
        "type": "influxdb",
        "hostname": "influxdb",
        "port": "8086",
        "protocol": "http",
        "database": "data",
        "name": "emerson_influxdb",
        "usetls": false,
        "tls": "",
        "influxdbVersion": "1.x",
        "url": "http://localhost:8086",
        "rejectUnauthorized": true
    }
]

Hi, there is not enough info to really help you.

for starters, not everyone will have your nodes. Example:

And even if we DID have the modbus and influx nodes installed, we dont have access to your network, your Modbus device or your influx DB - so posting them is completely pointless.

What is prefered in these situations is to capture the data coming out of modbus node (use the debug panel to accurately capture the data) then use Inject/change/function nodes to simulate your data:

Lastly, you should always explain what output you are trying to achieve by supplying values you expect to come out of the buffer parser.

Example:


Capturing data using the debug panel

There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path/value for any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi

One thing I did note:

You modbus node is only requesting 1 item and your buffer-parser is set to convert to a Float32BE

Modbus is ALWAYS returns 16 bit values. A float is 32 bit. It is impossible to convert a 16 bit (2 byte) value into a 32 bit (4 byte) value.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.