Skip to content

Commit

Permalink
Replace char array by String buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Sep 16, 2023
1 parent 21fb10f commit 1cf4142
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/MqttHandleHass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void MqttHandleHassClass::publishField(std::shared_ptr<InverterAbstract> inv, Ch
root["stat_cla"] = stateCls;
}

char buffer[512];
String buffer;
serializeJson(root, buffer);
publish(configTopic, buffer);
} else {
Expand Down Expand Up @@ -181,7 +181,7 @@ void MqttHandleHassClass::publishInverterButton(std::shared_ptr<InverterAbstract
JsonObject deviceObj = root.createNestedObject("dev");
createDeviceInfo(deviceObj, inv);

char buffer[512];
String buffer;
serializeJson(root, buffer);
publish(configTopic, buffer);
}
Expand Down Expand Up @@ -220,7 +220,7 @@ void MqttHandleHassClass::publishInverterNumber(
JsonObject deviceObj = root.createNestedObject("dev");
createDeviceInfo(deviceObj, inv);

char buffer[512];
String buffer;
serializeJson(root, buffer);
publish(configTopic, buffer);
}
Expand Down Expand Up @@ -249,7 +249,7 @@ void MqttHandleHassClass::publishInverterBinarySensor(std::shared_ptr<InverterAb
JsonObject deviceObj = root.createNestedObject("dev");
createDeviceInfo(deviceObj, inv);

char buffer[512];
String buffer;
serializeJson(root, buffer);
publish(configTopic, buffer);
}
Expand Down

0 comments on commit 1cf4142

Please sign in to comment.