Hi all,
@Steve-Mcl thank you for your amazing work on the buffer-parser. I have a feeling that I got something wrong, but if you could please assist me, that would be greatly appreciated!
I'm processing some binary Modbus alarms (if bit x is raised, then the alarm is on) with the following flow (this subflow is an example of how I've approached this):
[
{
"id": "e4c264bf156ed21c",
"type": "subflow",
"name": "Sample Bit16 (be) to Bool Flow",
"info": "",
"category": "",
"in": [
{
"x": 220,
"y": 280,
"wires": [
{
"id": "86f303ce2f0b0bbb"
}
]
}
],
"out": [],
"env": [],
"meta": {},
"color": "#DDAA99"
},
{
"id": "b81cf00b0f816964",
"type": "buffer-parser",
"z": "e4c264bf156ed21c",
"name": "Process Sample Modbus Registers",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "16bitbe",
"name": "Reg1",
"offset": 0,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "16bitbe",
"name": "Reg2",
"offset": 2,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
}
],
"swap1": "",
"swap2": "",
"swap3": "",
"swap1Type": "swap",
"swap2Type": "swap",
"swap3Type": "swap",
"msgProperty": "payload",
"msgPropertyType": "str",
"resultType": "object",
"resultTypeType": "return",
"multipleResult": true,
"fanOutMultipleResult": true,
"setTopic": true,
"outputs": 2,
"x": 620,
"y": 280,
"wires": [
[
"c92862b2260ba848",
"6eb455381b119990"
],
[
"2ed8f572bd8239c9",
"1939b2ea295e7641"
]
]
},
{
"id": "c92862b2260ba848",
"type": "buffer-parser",
"z": "e4c264bf156ed21c",
"name": "Process Binary Alarms",
"data": "payload.value",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "bool",
"name": "Continue",
"offset": 0,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Hold",
"offset": 0,
"length": 1,
"offsetbit": 1,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Off",
"offset": 0,
"length": 1,
"offsetbit": 2,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Start Over",
"offset": 0,
"length": 1,
"offsetbit": 3,
"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": 900,
"y": 220,
"wires": [
[
"244c868b8e3dc1ce"
]
]
},
{
"id": "244c868b8e3dc1ce",
"type": "debug",
"z": "e4c264bf156ed21c",
"name": "Debug SF",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 220,
"wires": []
},
{
"id": "6eb455381b119990",
"type": "debug",
"z": "e4c264bf156ed21c",
"name": "msg.payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 850,
"y": 140,
"wires": []
},
{
"id": "2ed8f572bd8239c9",
"type": "buffer-parser",
"z": "e4c264bf156ed21c",
"name": "Process Binary Alarms",
"data": "payload.value",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "bool",
"name": "Pass",
"offset": 0,
"length": 1,
"offsetbit": 0,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Drop",
"offset": 0,
"length": 1,
"offsetbit": 1,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Off",
"offset": 0,
"length": 1,
"offsetbit": 2,
"scale": "1",
"mask": ""
},
{
"type": "bool",
"name": "Restart",
"offset": 0,
"length": 1,
"offsetbit": 3,
"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": 900,
"y": 300,
"wires": [
[
"ad83ef7138325218"
]
]
},
{
"id": "ad83ef7138325218",
"type": "debug",
"z": "e4c264bf156ed21c",
"name": "Debug SF",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1120,
"y": 300,
"wires": []
},
{
"id": "1939b2ea295e7641",
"type": "debug",
"z": "e4c264bf156ed21c",
"name": "msg.payload",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 870,
"y": 380,
"wires": []
},
{
"id": "86f303ce2f0b0bbb",
"type": "function",
"z": "e4c264bf156ed21c",
"name": "4-Byte-Buffer",
"func": "let buf = [10, 8]\n\nmsg.payload = buf;\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 370,
"y": 280,
"wires": [
[
"b81cf00b0f816964"
]
]
},
{
"id": "eb37a9689c2c24f3",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-buffer-parser": "3.2.2"
}
}
]
The injected message for this bit is simply msg.payload. Since the buffer includes bits in 0 and 3 offset positions, I'd expect the final array to contain 1-2 "True" values; however, despite the raised '1's, there are no true values. What am I doing wrong?
Thank you in advance!






