Skip to content

Commit

Permalink
more debug
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Sep 15, 2023
1 parent 4d5b333 commit 90a6384
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extra_configs =
custom_ci_action = generic,generic_esp32,generic_esp32s3,generic_esp32s3_usb

framework = arduino
platform = espressif32@6.4.0
platform = espressif32@6.3.2

build_flags =
-DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/favicon.png:webapp_dist/js/app.js.gz
Expand Down
2 changes: 1 addition & 1 deletion src/MqttHandlVedirectHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void MqttHandleVedirectHassClass::publishConfig()

void MqttHandleVedirectHassClass::publishSensor(const char* caption, const char* icon, const char* subTopic, const char* deviceClass, const char* stateClass, const char* unitOfMeasurement )
{
MessageOutput.printf("[MqttHandleVedirectHassClass::publishSensor] free heap=%d caption=\"%s\", icon=\"%s\", subTopic=\"%s\", deviceClass=\"%s\", stateClass=\"%s\", unitOfMeasurement=\"%s\",\r\n", ESP.getFreeHeap(), caption, icon, subTopic, deviceClass, stateClass, unitOfMeasurement);
MessageOutput.printf("[MqttHandleVedirectHassClass::publishSensor] free heap=%d caption=\"%s\", icon=\"%s\", subTopic=\"%s\", deviceClass=\"%s\", stateClass=\"%s\", unitOfMeasurement=\"%s\",\r\n", ESP.getFreeHeap(), caption, icon != NULL ? icon : "", subTopic, deviceClass != NULL ? deviceClass : "", stateClass != NULL ? stateClass : "", unitOfMeasurement != NULL ? unitOfMeasurement : "");
String serial = VeDirect.veFrame.SER;

String sensorId = caption;
Expand Down
11 changes: 7 additions & 4 deletions src/MqttHandleHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ void MqttHandleHassClass::publishInverterNumber(
String cmdTopic = MqttSettings.getPrefix() + serial + "/" + commandTopic;
String statTopic = MqttSettings.getPrefix() + serial + "/" + stateTopic;

DynamicJsonDocument root(1024);
DynamicJsonDocument root(2048);
root["name"] = String(inv->name()) + " " + caption;
root["uniq_id"] = serial + "_" + buttonId;
if (strcmp(icon, "")) {
Expand All @@ -224,9 +224,12 @@ void MqttHandleHassClass::publishInverterNumber(
JsonObject deviceObj = root.createNestedObject("dev");
createDeviceInfo(deviceObj, inv);

char buffer[1024];
int byte = serializeJson(root, buffer);
MessageOutput.printf("[MqttHandleHassClass::publishInverterNumber] size of buffer: %d\r\n", byte);
char buffer[2048];
size_t byte = serializeJson(root, buffer);
MessageOutput.printf("[MqttHandleHassClass::publishInverterNumber] size of buffer: %d (%d) \r\n", byte, measureJson(root));
MessageOutput.printf("[MqttHandleHassClass::publishInverterNumber] name: \"%s\", id: \"%s\"\r\n", inv->name(), buttonId.c_str() );
MessageOutput.printf("[MqttHandleHassClass::publishInverterNumber] configTopic: \"%s\", statTopic: \"%s\"\r\n", configTopic.c_str(), statTopic.c_str() );
MessageOutput.printf("[MqttHandleHassClass::publishInverterNumber] cmdTopic: \"%s\", serial: \"%s\"\r\n", cmdTopic.c_str(), serial.c_str() );
publish(configTopic, buffer);
}

Expand Down

0 comments on commit 90a6384

Please sign in to comment.