Convert HEX to useful values?

Dear all,
I try to read an serial String and convert it to something "useful".
Therefore I would need the HEX output of the serial String but all I get are these strange signs when I connect the Serial IN to my serial unput from the external device.

payload: string
����1 $$V=�|wxr'n{zs�sy{���{}y|��R�
port: "/dev/ttyUSB0"
_msgid: "76d19c5373993c46"

Does anybody know how to convert this into something useful that I can start calculating with ?
I would need something like this:

return float((float(byte1 * 256) + float(byte2)) / 1000)

:slight_smile:
BR
G

this is how the protocol should look like, but I have no idea how to read and convert these values:

Use a buffer node to structure the buffer in your fields.

Ok, now I get decimal or integer values ... they do not mean anything but ok, first step done :slight_smile:

The serial input looks like this:

24 24 57 0F 0E 24 01 00 E6 00 81 00 84 5B 27
24 24 57 0F 0E 24 01 00 E4 00 81 00 84 5B 25
24 24 57 0F 0E 24 01 00 E1 00 83 00 84 5B 24
24 24 56 2D 0C FD 0D 04 0D 04 0D 02 0D 03 0D 04 0D 06 0D 01 0D 08 0D 02 0D 05 0C FE 0D 06 0C FB 0D 0F 0C FC 76 FE D5 02 63 14 0E 00 95
24 24 58 28 01 E4 00 01 00 03 00 03 00 03 00 02 00 03 00 00 00 00 00 01 00 01 00 01 00 00 00 05 00 02 00 03 00 03 00 CC
24 24 57 0F 0E 24 01 00 E4 00 83 00 84 5B 27

How do I tell my nodes to act differently if 242457 shows up or 242458 shows up .... do I have to use two different serial nodes ?

I tried to split the
24 24 56 2D 0C FD 0D 04 0D 04 0D 02 0D 03 0D 04 0D 06 0D 01 0D 08 0D 02 0D 05 0C FE 0D 06 0C FB 0D 0F 0C FC 76 FE D5 02 63 14 0E 00 95
Stream into smaller packets.
24 pieces with int16, 2 pieces int32 and another 2 pieces with int32

But something seems to be wrong with the offsets ... the values that I am able to read are somehow ... wrong

Are these multiple rackable Pylontech batteries?
Let's take the string above.
We could deduce that the last 4 bytes (before the checksum 95) are the Ampere/hours ( 63 14 0E 00 ), the block of 4 before and the Wh (76 FE D5 02 ), the previous blocks are the different rack of batteries. Is this your request?

image

No but very close - it is for my Chargery BMS for my 24 cell LTO PV-Battery.
Unfortunately I still do not get valid figures from the serial stream.

First I take the yellow line - it gives me the cell voltage for all 24 cells and additionally the actual Wh and Ah.
Cell Voltage works fine with the following template:

But have no idea how to get the 4 Byte Ah and Wh figures. I do neither know how to configure the Output (Int ? Float ? Bit ? Byte) nor how to calculate the 4 figures in a reasonable way.

Unfortunately this is my first time working with serial streams :frowning:

Some tracks

  • Can you show us the setup of the serial node.

  • Do you have any documentation on the protocol used by your BMS. The one you put an extract from.

  • What kind of cable you use to connect your bms to your pc or Pi.

  • Can you have the value of Ah or Wh via the debug of the serial node at the same time as reading live these values on your equipment? This to get an idea of the scales of values (comparison) and thus see how the information is coded.

This is the documentation:

I try to read the block starting with 24 24 56 (this is the line for single cell voltage)

The serial node looks like this:
image

and this is how I try to convert the blocks to decimal figures but I am afraid I am still mixing up length and offset to the outcome is a bit crappy

So I think - I have figured it out for you:

First of all you should take a LF or CR to get separate strings out of your serial node.

I took as Input Strings in my Inject Nodes the strings of each line.

  1. Inject Node - string:
24 24 57 0F 0E 24 01 00 E6 00 81 00 84 5B 27
  1. Inject Node - string

The next step is to convert this in an array and convert the hex numbers into decimal numbers - that is done by the change node.

$map($split(payload, " "), function ($v){$parseInteger($string("0x"& $v),'0')})

Then you need the buffer maker to create a buffer out of this array.

You can check this with the next node:

image

with the first buffer parser node - i selected out the command and in raw i took the old payload

image

The raw payload is then again parsed against the original payload with single bytes and taken the formula provide by your pdf document.

Here is the complete flow:

[
    {
        "id": "c4066602d25ae53e",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 4040,
        "wires": []
    },
    {
        "id": "3449578734ece62a",
        "type": "inject",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "24 24 57 0F 0E 24 01 00 E6 00 81 00 84 5B 27",
        "payloadType": "str",
        "x": 150,
        "y": 4060,
        "wires": [
            [
                "a8cdef912008e6df"
            ]
        ]
    },
    {
        "id": "a8cdef912008e6df",
        "type": "change",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$map($split(payload, \" \"), function ($v){$parseInteger($string(\"0x\"& $v),'0')\t})\t\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 330,
        "y": 4120,
        "wires": [
            [
                "89b8294d3eb1501e"
            ]
        ]
    },
    {
        "id": "89b8294d3eb1501e",
        "type": "buffer-maker",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "name": "item1",
                "type": "byte",
                "length": -1,
                "dataType": "msg",
                "data": "payload"
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "x": 530,
        "y": 4120,
        "wires": [
            [
                "c4066602d25ae53e",
                "8cf497c9586cb32a"
            ]
        ]
    },
    {
        "id": "8cf497c9586cb32a",
        "type": "buffer-parser",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "buffer",
                "name": "header",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "hex",
                "name": "command",
                "offset": 2,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint8",
                "name": "data length",
                "offset": 3,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "buffer",
                "name": "raw",
                "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": 710,
        "y": 4120,
        "wires": [
            [
                "13d0bf9ffe3719e7",
                "e08a7aa21261787e"
            ]
        ]
    },
    {
        "id": "13d0bf9ffe3719e7",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 970,
        "y": 4040,
        "wires": []
    },
    {
        "id": "e08a7aa21261787e",
        "type": "switch",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "property": "payload.command",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "56",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 510,
        "y": 4200,
        "wires": [
            [
                "f0a355f7aaf1156b"
            ]
        ]
    },
    {
        "id": "45b214b91c30c2dd",
        "type": "inject",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "24 24 56 2D 0C FD 0D 04 0D 04 0D 02 0D 03 0D 04 0D 06 0D 01 0D 08 0D 02 0D 05 0C FE 0D 06 0C FB 0D 0F 0C FC 76 FE D5 02 63 14 0E 00 95",
        "payloadType": "str",
        "x": 150,
        "y": 4120,
        "wires": [
            [
                "a8cdef912008e6df"
            ]
        ]
    },
    {
        "id": "8b74b862ea476be8",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1130,
        "y": 4140,
        "wires": []
    },
    {
        "id": "f70a6ac855e258dc",
        "type": "buffer-parser",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "byte",
                "name": "Wh",
                "offset": 36,
                "length": 4,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "byte",
                "name": "Ah",
                "offset": 40,
                "length": 4,
                "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": 870,
        "y": 4200,
        "wires": [
            [
                "8b74b862ea476be8",
                "2db2f501d7fd9afd"
            ]
        ]
    },
    {
        "id": "f0a355f7aaf1156b",
        "type": "change",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.raw",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 4200,
        "wires": [
            [
                "f70a6ac855e258dc"
            ]
        ]
    },
    {
        "id": "2db2f501d7fd9afd",
        "type": "change",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "Wh",
                "pt": "msg",
                "to": "(payload.Wh[0] + (payload.Wh[1]*256) + (payload.Wh[2]*256*256) + (payload.Wh[3]*256*256*256))/1000",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "Ah",
                "pt": "msg",
                "to": "(payload.Ah[0] + (payload.Ah[1]*256) + (payload.Ah[2]*256*256) + (payload.Ah[3]*256*256*256))/1000",
                "tot": "jsonata"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{}",
                "tot": "json"
            },
            {
                "t": "move",
                "p": "Wh",
                "pt": "msg",
                "to": "payload.Wh",
                "tot": "msg"
            },
            {
                "t": "move",
                "p": "Ah",
                "pt": "msg",
                "to": "payload.Ah",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1090,
        "y": 4200,
        "wires": [
            [
                "0550a0757f7f9721"
            ]
        ]
    },
    {
        "id": "0550a0757f7f9721",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1280,
        "y": 4200,
        "wires": []
    }
]

Edit - I corrected the flow - as there was an error in the first buffer parser - to interpret the length of the buffer. So the flow is corrected - and here is the configuration of the first parser.

1 Like

I do not know - how your serial node is configured - but with your output your posted before - you can probably directly use my flow - as I took your lines as input in the inject nodes.

Please try this : (you can test with ASCII string or Binary buffer.
image

and put the debug node just after to see what appen like that exemple
image

So I played a little bit with the buffer node - and when the buffer with the correct command has been passed - the following buffer node does completely parse the buffer according the provided scheme;

As you can see there is no longer a calculation necessary to get the requested values:

[
    {
        "id": "f669e17677373d53",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 790,
        "y": 4380,
        "wires": []
    },
    {
        "id": "1304975a13ac49d6",
        "type": "inject",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "24 24 57 0F 0E 24 01 00 E6 00 81 00 84 5B 27",
        "payloadType": "str",
        "x": 190,
        "y": 4400,
        "wires": [
            [
                "91b24aef2c3c5bdd"
            ]
        ]
    },
    {
        "id": "91b24aef2c3c5bdd",
        "type": "change",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$map($split(payload, \" \"), function ($v){$parseInteger($string(\"0x\"& $v),'0')\t})\t\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 370,
        "y": 4460,
        "wires": [
            [
                "ca180d40644869b2"
            ]
        ]
    },
    {
        "id": "ca180d40644869b2",
        "type": "buffer-maker",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "name": "item1",
                "type": "byte",
                "length": -1,
                "dataType": "msg",
                "data": "payload"
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "x": 570,
        "y": 4460,
        "wires": [
            [
                "f669e17677373d53",
                "f3b023e3dfbcaf36"
            ]
        ]
    },
    {
        "id": "f3b023e3dfbcaf36",
        "type": "buffer-parser",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "buffer",
                "name": "header",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "hex",
                "name": "command",
                "offset": 2,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint8",
                "name": "data length",
                "offset": 3,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "buffer",
                "name": "raw",
                "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": 750,
        "y": 4460,
        "wires": [
            [
                "5a427c9a55654be1",
                "730876530e61a979"
            ]
        ]
    },
    {
        "id": "5a427c9a55654be1",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1010,
        "y": 4380,
        "wires": []
    },
    {
        "id": "730876530e61a979",
        "type": "switch",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "property": "payload.command",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "56",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 550,
        "y": 4540,
        "wires": [
            [
                "82226fc39afcd225"
            ]
        ]
    },
    {
        "id": "8fa40c38156303f1",
        "type": "inject",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "24 24 56 2D 0C FD 0D 04 0D 04 0D 02 0D 03 0D 04 0D 06 0D 01 0D 08 0D 02 0D 05 0C FE 0D 06 0C FB 0D 0F 0C FC 76 FE D5 02 63 14 0E 00 95",
        "payloadType": "str",
        "x": 190,
        "y": 4460,
        "wires": [
            [
                "91b24aef2c3c5bdd"
            ]
        ]
    },
    {
        "id": "82226fc39afcd225",
        "type": "change",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "payload.raw",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 710,
        "y": 4540,
        "wires": [
            [
                "a70cd482daee9295"
            ]
        ]
    },
    {
        "id": "a70cd482daee9295",
        "type": "buffer-parser",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "byte",
                "name": "Header",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "hex",
                "name": "Command",
                "offset": 2,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint8",
                "name": "DataLength",
                "offset": 3,
                "length": 1,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell1",
                "offset": 4,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell2",
                "offset": 6,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell3",
                "offset": 8,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell4",
                "offset": 10,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell5",
                "offset": 12,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell6",
                "offset": 14,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell7",
                "offset": 16,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell8",
                "offset": 18,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell9",
                "offset": 20,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell10",
                "offset": 22,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell11",
                "offset": 24,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell12",
                "offset": 26,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell13",
                "offset": 28,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell14",
                "offset": 30,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell15",
                "offset": 32,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint16be",
                "name": "Cell16",
                "offset": 34,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint32le",
                "name": "Wh",
                "offset": 36,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint32le",
                "name": "Ah",
                "offset": 40,
                "length": 1,
                "offsetbit": 0,
                "scale": "/1000",
                "mask": ""
            },
            {
                "type": "uint8",
                "name": "CheckSum",
                "offset": 44,
                "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": 910,
        "y": 4540,
        "wires": [
            [
                "1a07f04d487795eb"
            ]
        ]
    },
    {
        "id": "1a07f04d487795eb",
        "type": "debug",
        "z": "78d94accf7f5ec3c",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1090,
        "y": 4540,
        "wires": []
    }
]

If you can filter out the correct message in other way - you can more or less directly use the buffer node to parse the buffer.

2 Likes

Whooww
Fully tested and approved. I will use it soon for one of my next project. Nice work.

1 Like

It works perfectly fine now for me with the following settings:

image

IF a 0x56 is sent via Serial, the Node reacts and reads the following 59 characters .... decoding them with the attached template. Take care to use the right LE and BE Types !

BUT ... problem is that the trigger should not be 0x56 only, but 0x24 0x24 0x56 and I have no idea how put this into the Serial node.

Any ideas ?

If you look to my complete flow - you should not separate by 0x56 in your serial node use LF that you have the same strings as posted earlier. After the frist buffer node the command is extracted exactly as the third byte.

do you mean the serial data should be split when 0x24 0x24 0x56 (or as a string $$V) is received? OR when any character of 0x24 or 0x24 or 0x56 arrives)?

If you mean the latter, try splitting on $$V

$ is ascii char 36 (0x24)
V is ascii char 86 (0x56)

No, I mean I want to ignore the serial stream until 0x24 0x24 0x56 shows up. After that I want to read 57 characters and then I want to ignore the stream again until the same pattern shows up again.
Because this is the pattern that tells me: next 57 characters are of interest

To be honest I am unable to replicate your flow.
You are not using the "serial-port" node which I use to read the "interesting" part of the stream.

You said: "use LF" but I have no idea how to tell the serial-port to do so.