mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
restart MQTT when settings change from Web
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
class EMSESP {
|
class EMSESP {
|
||||||
public:
|
public:
|
||||||
static System system_;
|
|
||||||
static Mqtt mqtt_;
|
static Mqtt mqtt_;
|
||||||
static DallasSensor dallassensor_;
|
static DallasSensor dallassensor_;
|
||||||
};
|
};
|
||||||
@@ -93,14 +92,12 @@ AsyncMqttClient * MqttSettingsService::getMqttClient() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsService::onMqttConnect(bool sessionPresent) {
|
void MqttSettingsService::onMqttConnect(bool sessionPresent) {
|
||||||
/*
|
// Serial.print(F("Connected to MQTT, "));
|
||||||
Serial.print(F("Connected to MQTT, "));
|
// if (sessionPresent) {
|
||||||
if (sessionPresent) {
|
// Serial.println(F("with persistent session"));
|
||||||
Serial.println(F("with persistent session"));
|
// } else {
|
||||||
} else {
|
// Serial.println(F("without persistent session"));
|
||||||
Serial.println(F("without persistent session"));
|
// }
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsService::onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
void MqttSettingsService::onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
||||||
@@ -116,6 +113,7 @@ void MqttSettingsService::onConfigUpdated() {
|
|||||||
|
|
||||||
// added by proddy
|
// added by proddy
|
||||||
// reload EMS-ESP MQTT settings
|
// reload EMS-ESP MQTT settings
|
||||||
|
emsesp::EMSESP::mqtt_.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
|
|||||||
Reference in New Issue
Block a user