MQTT improvements (#1487)

* removed no longer used code

* updated logs

* increased heap memory. this most likely was the reason that the MQTT init failed, see https://github.com/jomjol/AI-on-the-edge-device/issues/1455#issuecomment-1336450501

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2022-12-05 06:55:08 +01:00
committed by GitHub
parent 4b52e61755
commit e87b91f6eb
5 changed files with 26 additions and 22 deletions

View File

@@ -176,7 +176,7 @@ bool MQTT_Init() {
if ((client_id.length() == 0) || (lwt_topic.length() == 0))
{
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, std::string("Init with no Client_ID or Topic. Abort Init!"));
LogFile.WriteToFile(ESP_LOG_ERROR, TAG, std::string("Init with no Client_ID (" + client_id + ") or Last Will Topic (" + lwt_topic + "). Abort Init!"));
return false;
}

View File

@@ -162,7 +162,7 @@ void MQTThomeassistantDiscovery() {
void publishSystemData() {
char tmp_char[50];
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Publishing system MQTT topics...");
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Publishing system MQTT topics...");
sprintf(tmp_char, "%ld", (long)getUpTime());
MQTTPublish(maintopic + "/" + "uptime", std::string(tmp_char), retainFlag);
@@ -179,7 +179,7 @@ void publishSystemData() {
void publishStaticData() {
LogFile.WriteToFile(ESP_LOG_INFO, TAG, "Publishing static MQTT topics...");
LogFile.WriteToFile(ESP_LOG_DEBUG, TAG, "Publishing static MQTT topics...");
MQTTPublish(maintopic + "/" + "MAC", getMac(), retainFlag);
MQTTPublish(maintopic + "/" + "IP", *getIPAddress(), retainFlag);
MQTTPublish(maintopic + "/" + "hostname", hostname, retainFlag);