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() { void GitUpdater::loop() {
if(this->status == GIT_STATUS_READY) { if(this->status == GIT_STATUS_READY) {
if(this->lastCheck + 14400000 < millis()) { // 4 hours if(this->lastCheck + 14400000 < millis() && !rebootDelay.reboot) { // 4 hours
this->checkForUpdate(); this->checkForUpdate();
} }
} }

View file

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

Binary file not shown.

Binary file not shown.