mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Enlarge statusupdate buffer size
This commit is contained in:
parent
762d5190ac
commit
6bdab1f911
@ -196,26 +196,27 @@ void mqtt_send_statusupdate()
|
|||||||
// String mqttStatusPayload((char *)0);
|
// String mqttStatusPayload((char *)0);
|
||||||
// mqttStatusPayload.reserve(512);
|
// mqttStatusPayload.reserve(512);
|
||||||
|
|
||||||
DynamicJsonDocument doc(256);
|
DynamicJsonDocument doc(3 * 128);
|
||||||
|
|
||||||
doc[F("status")] = F("available");
|
doc[F("status")] = F("available");
|
||||||
doc[F("version")] = haspGetVersion();
|
doc[F("version")] = haspGetVersion();
|
||||||
doc[F("uptime")] = long(millis() / 1000);
|
doc[F("uptime")] = long(millis() / 1000);
|
||||||
doc[F("rssi")] = WiFi.RSSI();
|
doc[F("rssi")] = WiFi.RSSI();
|
||||||
doc[F("ip")] = WiFi.localIP().toString();
|
doc[F("ip")] = WiFi.localIP().toString();
|
||||||
doc[F("heapFree")] = ESP.getFreeHeap();
|
doc[F("heapFree")] = ESP.getFreeHeap();
|
||||||
doc[F("heapFrag")] = halGetHeapFragmentation();
|
doc[F("heapFrag")] = halGetHeapFragmentation();
|
||||||
doc[F("updateEspAvailable")] = false;
|
doc[F("espCanUpdate")] = false;
|
||||||
doc[F("espCore")] = halGetCoreVersion().c_str();
|
doc[F("espCore")] = halGetCoreVersion().c_str();
|
||||||
|
|
||||||
char buffer[256];
|
|
||||||
size_t n = serializeJson(doc, buffer);
|
|
||||||
mqtt_send_state(F("statusupdate"), buffer);
|
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_ESP8266)
|
#if defined(ARDUINO_ARCH_ESP8266)
|
||||||
doc[F("espVcc")] = (float)ESP.getVcc() / 1000;
|
doc[F("espVcc")] = (float)ESP.getVcc() / 1000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char buffer[3 * 128];
|
||||||
|
size_t n = serializeJson(doc, buffer, sizeof(buffer));
|
||||||
|
mqtt_send_state(F("statusupdate"), buffer);
|
||||||
|
|
||||||
|
|
||||||
/* if(updateEspAvailable) {
|
/* if(updateEspAvailable) {
|
||||||
mqttStatusPayload += F("\"updateEspAvailable\":true,");
|
mqttStatusPayload += F("\"updateEspAvailable\":true,");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user