bphermansson / EspSparsnasGateway

Reads data from Ikea Sparsnäs energy meter and publish via Mqtt.
MIT License
39 stars 27 forks source link

Increased MQTTClient buffer size #46

Closed whyz closed 4 years ago

whyz commented 4 years ago

Increased MQTTClient buffer size from (default) 128 to 256 to be able to fit larger JSON messages. Fix compilation warning. extern MQTTClient.

whyz commented 4 years ago

Without the increased buffer size, status messages bigger than 128 bytes are discarded and never sent to the MQTT server. This fix is crucial, at least on nodemcu v3.

bphermansson commented 4 years ago

I've merged Riksarchens version with Pubsubclient just now. I think you can adjust the max value here to:

https://github.com/knolleary/pubsubclient/blob/master/src/PubSubClient.h 26 #define MQTT_MAX_PACKET_SIZE 128

But I wonder if we should allow larger messages or if we should trim the messages to a more reasonable size instead?