Send multiple sensor readings in one MQTT payload



I used the example code from this link to send data from a Python program using MQTT.

I was able to successfully send one sensor reading.

client.publish(resource, raw_data, qos=0)


When I edited the same code to send reading from more than one sensor, it doesn’t work.

client.publish(resource, raw_data, qos=0)

I see from the MQTT specs that the payload is limited to 268,435,456 bytes. I’m not hitting that limit. Is there something I’m missing here?

Kind regards,


Hi Vijay,

Could you clarify for me what the issue is that you have run into? I see from your second bit of example code that you have a key/value for “t4”, however, that did not come through in what is logged for the Product. Is that the discrepancy you are wondering about?

As you noted, there is a payload limit, but one that you do not appear to be close to hitting. I just tried approximately the same request, with the sensor values hard-coded, and the publish was successful:

client.publish(resource, raw_data, qos=0)

Do you have multiple MQTT clients connecting to your Product? Could you run your Python program again and share the results? It may also be helpful to include the timestamps from the logs.