#error "MQTT_MAX_PACKET_SIZE is too small in libaries

530 views
Skip to first unread message

Slip7000

unread,
Mar 11, 2017, 9:01:35 AM3/11/17
to SonoffUsers
Hi all,


I'm getting this error when trying to compile the Sonoff firmware in Arduino

#error "MQTT_MAX_PACKET_SIZE is too small in libraries/PubSubClient/src/PubSubClient.h, increase it to at least 427"

 please help 

Julian Knight

unread,
Mar 11, 2017, 10:55:22 AM3/11/17
to SonoffUsers
You are trying to send too long a message to MQTT or have changed the indicated constant in the pubsubclient library incorrectly. If you haven't changed anything, you might like to re-download the latest code in case you have an issue somewhere.

David Lang

unread,
Mar 11, 2017, 4:35:08 PM3/11/17
to Slip7000, SonoffUsers
you need to do exactly what the message says, go to
libraries/PubSubClient/src/PubSubClient.h, find the variable
MQTT_MAX_PACKET_SIZE and change it to a larger value (something higher than 427)

This is a library downloaded separately

On Sat, 11 Mar 2017, Slip7000 wrote:

> Date: Sat, 11 Mar 2017 06:01:34 -0800 (PST)
> From: Slip7000 <josia.m...@live.co.za>
> To: SonoffUsers <sonof...@googlegroups.com>
> Subject: #error "MQTT_MAX_PACKET_SIZE is too small in libaries

Bernard T

unread,
Mar 12, 2017, 6:04:14 AM3/12/17
to SonoffUsers
MQTT_MAX_PACKET_SIZE is set to 512 already, I get the same error


On Saturday, 11 March 2017 14:01:35 UTC, Slip7000 wrote:

Petr Faitl

unread,
Mar 12, 2017, 6:42:30 AM3/12/17
to SonoffUsers
Make sure you're editing the correct library. If you setup your sketch folder as default, it will be looking at that location for the library. The easiest is to do a search on your machine for MQTT_MAX_PACKET_SIZE and see how many files it finds. then edit the one that has the packet too small and you're done.

Bernard T

unread,
Mar 12, 2017, 7:24:41 AM3/12/17
to SonoffUsers
It's a bit strange, I use ice as standalone/portable, copied the libraries across from the zip, they are the same 512, I'll have another look later
Thanks

Petr Faitl

unread,
Mar 12, 2017, 3:44:08 PM3/12/17
to SonoffUsers
I did the same, but my sketch default folder was elsewhere and so Arduino didn't see the included libraries. These i have promptly downloaded, but as they were fresh copies they didn't have the MQTT MAX PACKET SIZE adjusted. I too couldn't see the issue until my system search revealed several copies of the library.

Bernard T

unread,
Mar 12, 2017, 5:49:23 PM3/12/17
to SonoffUsers
Ok I found 12 copies of the library LOL, I've got it working by changing default settings in the portable IDE. Thanks for the help, I'm off to play with it for a few hours.


On Saturday, 11 March 2017 14:01:35 UTC, Slip7000 wrote:
Reply all
Reply to author
Forward
0 new messages