This commit is contained in:
MichaelDvP
2024-02-15 09:08:01 +01:00
110 changed files with 1942 additions and 1923 deletions

View File

@@ -201,9 +201,9 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
for (const auto & mqtt_subfunction : mqtt_subfunctions_) {
shell.printfln(" %s/%s", Mqtt::base().c_str(), mqtt_subfunction.topic_.c_str());
}
shell.println();
shell.println();
shell.println();
}
#if defined(EMSESP_TEST)
@@ -388,7 +388,7 @@ void Mqtt::start() {
// add the 'publish' command ('call system publish' in console or via API)
Command::add(EMSdevice::DeviceType::SYSTEM, F_(publish), System::command_publish, FL_(publish_cmd));
// create last will topic with the base prefixed. It has to be static because asyncmqttclient destroys the reference
// create last will topic with the base prefixed. It has to be static because the client destroys the reference
static char will_topic[MQTT_TOPIC_MAX_SIZE];
if (!Mqtt::base().empty()) {
snprintf(will_topic, MQTT_TOPIC_MAX_SIZE, "%s/status", Mqtt::base().c_str());
@@ -466,6 +466,7 @@ void Mqtt::on_disconnect(espMqttClientTypes::DisconnectReason reason) {
return;
}
connecting_ = false;
if (reason == espMqttClientTypes::DisconnectReason::TCP_DISCONNECTED) {
LOG_WARNING("MQTT disconnected: TCP");
} else if (reason == espMqttClientTypes::DisconnectReason::MQTT_UNACCEPTABLE_PROTOCOL_VERSION) {
@@ -483,6 +484,7 @@ void Mqtt::on_disconnect(espMqttClientTypes::DisconnectReason reason) {
} else {
LOG_WARNING("MQTT disconnected: code %d", reason);
}
mqttClient_->clearQueue(true);
}