Modbus result = 32752

Hi,

I have a kohler apm 402 generator controller and i successfully connected to it with the node-red-contrib-modbus

What is stange is that i get correct readings when i shift all registers from 1. Like i get the fuel level on register 1105 when it is supposed to be on register 1106.

Also a lot of the responses i have are 32752 or 32767 wich is, i think, the max value of an int16. Others wich are Strings give 0.

I tried to decode with the buffer parser with every settings, byte swap and whatnot and can't get a logical value out of them.
Below is the register chart.
Any ideas?

There is often an off by one error in docs. This is due to some manufacturers starting from 1 and others starting from zero. Then there are typos!

Not really, you have not supplied a capture of sample input data nor any realistic example of what the final value(s) should be.

Pick a register, provide real captured data in a function node or template and your progress on buffer parser flow and export it. Also, provide the value you expect it to be.

the thing is that it's the same value from a bunch of registers, ex: from 1106 to 1116, 1119 to 1127 alaways the same array withe that number in it: [32752], those registers can't have the same value.

I don't understand how "to put captured data in a function node"

Add a debug to the end of the modbus node.
Set the debug to output the COMPLETE MESSAGE
Use the Copy Value button
Paste the copied code into a function like this:

return <paste-copy-data>

Getting data from messages

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

Thank you Steve, i was not aware how to do that

return <paste-copy-data>

But like i said a bunch of registers give me the same value.

[
    {
        "id": "5b592e561f6a0087",
        "type": "buffer-parser",
        "z": "210d4bb2856c7935",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int16be",
                "name": "item1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 490,
        "y": 1380,
        "wires": [
            [
                "50008624a981021c"
            ]
        ]
    },
    {
        "id": "3e08f6b03c95841b",
        "type": "function",
        "z": "210d4bb2856c7935",
        "name": "function 2",
        "func": "\nreturn { \"topic\": \"ddd203704ceff98f\", \"messageId\": \"67a130531e302eb43e8bb489\", \"payload\": [32752], \"queueLengthByUnitId\": { \"unitId\": 1, \"queueLength\": 0 }, \"queueUnitId\": 1, \"unitId\": 1, \"modbusRequest\": { \"value\": 1738616915219, \"unitid\": \"1\", \"fc\": 3, \"address\": \"1109\", \"quantity\": \"1\", \"messageId\": \"67a130531e302eb43e8bb489\" }, \"responseBuffer\": { \"data\": [32752], \"buffer\": [127, 240] }, \"_msgid\": \"82c3756a384214f2\" }",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 320,
        "y": 1420,
        "wires": [
            [
                "5b592e561f6a0087",
                "89ee906547774cec",
                "7851ffe3ec7f3edf"
            ]
        ]
    },
    {
        "id": "2cef89322d0395b9",
        "type": "inject",
        "z": "210d4bb2856c7935",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 150,
        "y": 1420,
        "wires": [
            [
                "3e08f6b03c95841b"
            ]
        ]
    },
    {
        "id": "50008624a981021c",
        "type": "debug",
        "z": "210d4bb2856c7935",
        "name": "debug 49",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 1380,
        "wires": []
    },
    {
        "id": "89ee906547774cec",
        "type": "buffer-parser",
        "z": "210d4bb2856c7935",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int16be",
                "name": "item1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 490,
        "y": 1420,
        "wires": [
            [
                "c4782b6323c9f752"
            ]
        ]
    },
    {
        "id": "c4782b6323c9f752",
        "type": "debug",
        "z": "210d4bb2856c7935",
        "name": "debug 51",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 1420,
        "wires": []
    },
    {
        "id": "b43e7fc1cf70f330",
        "type": "buffer-parser",
        "z": "210d4bb2856c7935",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int16be",
                "name": "item1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "swap16",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 490,
        "y": 1460,
        "wires": [
            []
        ]
    },
    {
        "id": "7851ffe3ec7f3edf",
        "type": "buffer-parser",
        "z": "210d4bb2856c7935",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "int16le",
                "name": "item1",
                "offset": 0,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "return",
        "multipleResult": false,
        "fanOutMultipleResult": false,
        "setTopic": true,
        "outputs": 1,
        "x": 490,
        "y": 1460,
        "wires": [
            [
                "40a8ab858fefba6e"
            ]
        ]
    },
    {
        "id": "40a8ab858fefba6e",
        "type": "debug",
        "z": "210d4bb2856c7935",
        "name": "debug 52",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 1460,
        "wires": []
    }
]

You have only requested 1 register (1109) - therefore you can only parse one value. That is highly wasteful (leads to increased traffic, inconsistent data, inextensible/unmaintainable flows)

If you request as many as possible (up to 125) you can parse them all at once.

Anyhow, as requested , you have not provided the expected value for this register. Are you expecting it to be parsed to a negative number? Somewhere between 0~99? Something over 20000? A clue would make this easier. In fact, providing a larger chunk of data would help determine if the addresses are out of step (easier to see a pattern)