0
votes

The devices are sending ASCII strings to the broker. I was expecting a string in the payload. But Node-Red's MQTT node treats it as a binary blob.

I am aware that MQTT treats all payloads as blobs. But the same node correctly shows payload as string when message is sent from a desktop MQTT client. So this appears to be an encoding issue.

While it is not difficult to add another node to convert the data to string, I was wondering if there is a better way to handle this - like some setting in node-red to interpret payload as ASCII for specific node.

1

1 Answers

0
votes

The MQTT-in node uses the is-utf8 npm node to test the incoming messages to see if they are strings.

If you are getting buffers passed then the incoming message is failing this test, I would check what encoding the "device" is using to encode the string.