[BUG] MQTT tb_utility.py returns string instead of binary object
Describe the bug Im using a MQTT integration with a custom decoder. I have written the decoder and placed it in the extension/mqtt folder and TB GW is able to load it as expected.
The MQTT payload is in Protobuf format. And i got stuck in the fact that the input into my custom extension/class was a string containing "[19B blob data]" instead of the actual binary payload.
After some more digging i found that the issue seem to be related to the "decode" function in the "TBUtility" class in the tb_utility.py file. I performed a change that returns the message.payload in the JSONDecodeError except and after that, my custom decoder class started working:
I could not get the code formating to work correctly so i attach a screenshot instead.
How can this be solved permently?
Connector name (If bug in the some connector): MQTT - With custom decoder
Versions (please complete the following information):
- OS: Ubuntu
- Thingsboard IoT Gateway version 3.7.3
- Python version: 3.10.12
Hi @jh83,
Thank you for your interest in ThingsBoard IoT Gateway. Please find related commit, I have adjusted errors handling during decoding - please try and let us know about the results.
Hi,
The new version is released. Please try to use it, feel free to open new issue if you discover something.