new action resetMQTT, called from MQTT Settings page

This commit is contained in:
proddy
2025-11-17 12:26:14 +01:00
parent 88afd3f453
commit 0a75dd7e3c
4 changed files with 49 additions and 11 deletions

View File

@@ -321,8 +321,12 @@ void Mqtt::on_publish(uint16_t packetId) const {
LOG_DEBUG("Packet %d sent successful", packetId);
}
// called when MQTT settings have changed via the Web forms
// called when MQTT settings have changed via the MQTT Settings or Application Settings Web pages
void Mqtt::reset_mqtt() {
if (!enabled()) {
return;
}
if (!mqttClient_) {
return;
}

View File

@@ -195,6 +195,9 @@ void WebStatusService::action(AsyncWebServerRequest * request, JsonVariant json)
ok = uploadURL(param.c_str());
} else if (action == "systemStatus" && is_admin) {
ok = setSystemStatus(param.c_str());
} else if (action == "resetMQTT" && is_admin) {
emsesp::EMSESP::mqtt_.reset_mqtt();
ok = true;
}
#if defined(EMSESP_STANDALONE) && !defined(EMSESP_UNITY)