[
{
"id": "84b7a77b43d96a87",
"type": "function",
"z": "78d94accf7f5ec3c",
"name": "UInt16LE \"0000 0011\" \"0000 0000\" ",
"func": "const buf= new Buffer(2);\nbuf.writeUInt16LE(msg.payload, 0);\nmsg.payload = buf;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 380,
"y": 3760,
"wires": [
[
"0a65de15fbd2ddfd"
]
]
},
{
"id": "0a65de15fbd2ddfd",
"type": "buffer-parser",
"z": "78d94accf7f5ec3c",
"name": "Get Bytes out of Bits",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "8bit",
"name": "bits",
"offset": 0,
"length": 1,
"offsetbit": 1,
"scale": "1",
"mask": "3"
}
],
"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": 680,
"y": 3760,
"wires": [
[
"c47aeabf65f381d0"
]
]
},
{
"id": "b7558809d659bd6b",
"type": "inject",
"z": "78d94accf7f5ec3c",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"v": "payload",
"vt": "msg"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "3",
"payloadType": "num",
"x": 150,
"y": 3760,
"wires": [
[
"84b7a77b43d96a87"
]
]
},
{
"id": "c47aeabf65f381d0",
"type": "switch",
"z": "78d94accf7f5ec3c",
"name": "",
"property": "payload.bits[0].bit0 = payload.bits[0].bit1",
"propertyType": "jsonata",
"rules": [
{
"t": "true"
},
{
"t": "false"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 870,
"y": 3760,
"wires": [
[
"e99c87c8984d8b2b"
],
[
"a456f699c852c0ae",
"cef34f1e7acd2ab0"
]
]
},
{
"id": "e99c87c8984d8b2b",
"type": "change",
"z": "78d94accf7f5ec3c",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.bits[0].bit0",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 3720,
"wires": [
[
"d781081c682909b2"
]
]
},
{
"id": "d781081c682909b2",
"type": "switch",
"z": "78d94accf7f5ec3c",
"name": "",
"property": "payload",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "0",
"vt": "num"
},
{
"t": "eq",
"v": "1",
"vt": "num"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1230,
"y": 3720,
"wires": [
[
"b892f7592f3a038c"
],
[
"2edaa9a292554104"
]
]
},
{
"id": "b892f7592f3a038c",
"type": "debug",
"z": "78d94accf7f5ec3c",
"name": "0",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1370,
"y": 3700,
"wires": []
},
{
"id": "2edaa9a292554104",
"type": "debug",
"z": "78d94accf7f5ec3c",
"name": "1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1370,
"y": 3740,
"wires": []
},
{
"id": "a456f699c852c0ae",
"type": "change",
"z": "78d94accf7f5ec3c",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.bits[0].bit0",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 3780,
"wires": [
[]
]
},
{
"id": "cef34f1e7acd2ab0",
"type": "change",
"z": "78d94accf7f5ec3c",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.bits[0].bit1",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 3860,
"wires": [
[]
]
}
]
Here an example to solve it with a flow - I just edited the change node for equal bits.