This commit is contained in:
jomjol
2022-01-14 20:18:24 +01:00
parent 2daf6c8b3f
commit e79c86c7b6
86 changed files with 8008 additions and 1803 deletions

View File

@@ -111,10 +111,20 @@ void MQTTInit(std::string _mqttURI, std::string _clientid, std::string _user, st
};
client = esp_mqtt_client_init(&mqtt_cfg);
esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client);
esp_mqtt_client_start(client);
if (client)
{
if (esp_mqtt_client_register_event(client, esp_mmqtt_ID, mqtt_event_handler, client) != ESP_OK)
LogFile.WriteToFile("MQTT - Could not register event!");
if (esp_mqtt_client_start(client) != ESP_OK)
LogFile.WriteToFile("MQTT - Could not start client!");
MQTTPublish(_LWTContext, "", 1);
}
else
{
LogFile.WriteToFile("MQTT - Could not Init MQTT Client!");
}
MQTTPublish(_LWTContext, "", 1);
}
void MQTTdestroy() {