'Decoding MQTT Payloads
I have a MQTT message with a payload of:
b'\x08\xbd\x81\xc8\xf6\x890\x12D\n0SWD/CATTLE CREEK INJECTION PAD 1/CASING PRESSURE\x18\xd4\xf9\xc7\xf6\x890 \t8\x00J\x00e\xf4\xf6\x1cE\x12E\n1SWD/CATTLE CREEK INJECTION PAD 1/ANNULUS PRESSURE\x18\xd5\xfc\xc7\xf6\x890 \t8\x00J\x00e2\xbd&C\x12D\n0SWD/CATTLE CREEK INJECTION PAD 1/TUBING PRESSURE\x18\xff\xff\xc7\xf6\x890 \t8\x00J\x00e\xa9=nD\x18A'
I'm trying to figure out how to parse this data. It looks like the protocol starts the message with
\x08\xbd\x81\xc8\xf6\x890\x12D\n0
Followed by the data key and corrosponding byte value:
SWD/CATTLE CREEK INJECTION PAD 1/CASING PRESSURE\x18\xd4\xf9\xc7\xf6\x890 \t8\x00J\x00e\xf4\xf6\x1cE\x12E\n1
SWD/CATTLE CREEK INJECTION PAD 1/ANNULUS PRESSURE\x18\xd5\xfc\xc7\xf6\x890 \t8\x00J\x00e2\xbd&C\x12D\n0
WD/CATTLE CREEK INJECTION PAD 1/TUBING PRESSURE\x18\xff\xff\xc7\xf6\x890 \t8\x00J\x00e\xa9=nD\x18A
Is there a library to quickly parse this into the corresponding floats or integer values? Or any suggestions?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
