Do not reload MQTT if the device is rebooting

This commit is contained in:
Robert Strouse 2024-01-05 19:11:55 -08:00
parent 2b30646114
commit 2bb23e6d3e
4 changed files with 4 additions and 2 deletions

View file

@ -231,7 +231,7 @@ bool GitRepo::toJSON(JsonObject &obj) {
void GitUpdater::loop() {
if(this->status == GIT_STATUS_READY) {
if(this->lastCheck + 14400000 < millis()) { // 4 hours
if(this->lastCheck + 14400000 < millis() && !rebootDelay.reboot) { // 4 hours
this->checkForUpdate();
}
}

View file

@ -5,6 +5,7 @@
#include "ConfigSettings.h"
#include "Somfy.h"
#include "Network.h"
#include "Utils.h"
WiFiClient tcpClient;
PubSubClient mqttClient(tcpClient);
@ -15,6 +16,7 @@ static char g_content[MQTT_MAX_RESPONSE];
extern ConfigSettings settings;
extern SomfyShadeController somfy;
extern Network net;
extern rebootDelay_t rebootDelay;
bool MQTTClass::begin() {
@ -32,7 +34,7 @@ void MQTTClass::reset() {
this->connect();
}
bool MQTTClass::loop() {
if(settings.MQTT.enabled && !this->suspended && !mqttClient.connected())
if(settings.MQTT.enabled && !rebootDelay.reboot && !this->suspended && !mqttClient.connected())
this->connect();
if(settings.MQTT.enabled) mqttClient.loop();
return true;

Binary file not shown.

Binary file not shown.