Hi,
I have a device sending temperature updates via UDP which I want to display on a Dashboard. The data is as follows:
Enc Data: 3a203134300d0a02021000a6170000
It is only 2 digits out of this string I require and they are near the center of the number.
How do I get only the ENC data.
Hi, welcome to the forum.
unfortunately you have not provided enough detail to really help you.
I would use the buffer-parser package (its build for helping you extract and convert values from a buffer (byte data)) which is what you are trying to achieve.
But if you tell us which digits and what format the number is, we can provide you a working demo.
Do you have a specification of that data format?
Hi Steve,
Thanks for the reply.
The data packets look like this:
Frame 571: 73 bytes on wire (584 bits), 73 bytes captured (584 bits)
Ethernet II, Src: ZenitelNorwa_0e:0f:f2 (00:13:cb:0e:0f:f2), Dst: ZenitelNorwa_0e:21:be (00:13:cb:0e:21:be)
Internet Protocol Version 4, Src: 192.168.1.55, Dst: 192.168.1.57
User Datagram Protocol, Src Port: 5035, Dst Port: 5035
Source Port: 5035
Destination Port: 5035
<Source or Destination Port: 5035>
<Source or Destination Port: 5035>
Length: 39
Checksum: 0xc290 [unverified]
[Checksum Status: Unverified]
[Stream index: 0]
[Timestamps]
UDP payload (31 bytes)
SKYPE
ID: 0x4441
0101 .... = Unknown: 0x5
.... 0011 = Type: Fragment/Forward/Resend (0x3)
Num: 0x56
Unk1: 0x02000d00
IV: 0x0000536f
CRC: 0x75726365
Enc Data: 3a203134300d0a02021000a6170000
[Community ID: 1:uDIU6EqA5BKIIfvo+gTUV9f0SUg=]
The 2 digits I require are in red (a6)
Assuming it is always the 11th byte then you can simply pull it out and format it using buffer parser node (install that using palette manager)
[
{
"id": "91de98fbc3639adf",
"type": "inject",
"z": "7ecf422396bf31b4",
"name": "udp data",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "3a203134300d0a02021000a6170000",
"payloadType": "str",
"x": 990,
"y": 1220,
"wires": [
[
"c8437066170d375a"
]
]
},
{
"id": "c8437066170d375a",
"type": "buffer-parser",
"z": "7ecf422396bf31b4",
"name": "",
"data": "payload",
"dataType": "msg",
"specification": "spec",
"specificationType": "ui",
"items": [
{
"type": "uint8",
"name": "temp",
"offset": 11,
"length": 1,
"offsetbit": 0,
"scale": "0",
"mask": ""
},
{
"type": "uint8",
"name": "tempScaled",
"offset": 11,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "hex",
"name": "tempHex",
"offset": 11,
"length": 1,
"offsetbit": 0,
"scale": "0.1",
"mask": ""
},
{
"type": "buffer",
"name": "raw",
"offset": 11,
"length": 1,
"offsetbit": 0,
"scale": "0.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": 1160,
"y": 1220,
"wires": [
[
"42cf58dc63b107c2"
]
]
},
{
"id": "42cf58dc63b107c2",
"type": "debug",
"z": "7ecf422396bf31b4",
"name": "debug 9",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1370,
"y": 1220,
"wires": []
},
{
"id": "679581b7087bfb40",
"type": "global-config",
"env": [],
"modules": {
"node-red-contrib-buffer-parser": "3.2.2"
}
}
]
