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.