thingsboard-gateway icon indicating copy to clipboard operation
thingsboard-gateway copied to clipboard

[BUG] MQTT tb_utility.py returns string instead of binary object

Open jh83 opened this issue 7 months ago • 1 comments

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.

Image

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

jh83 avatar May 07 '25 05:05 jh83

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.

imbeacon avatar May 21 '25 05:05 imbeacon

Hi,

The new version is released. Please try to use it, feel free to open new issue if you discover something.

imbeacon avatar Jul 08 '25 06:07 imbeacon