Fix endless reboot on webserver disable

This commit is contained in:
iranl
2025-01-08 20:48:57 +01:00
parent 84a6648d97
commit 9e36fe0857
2 changed files with 4 additions and 10 deletions

View File

@@ -5,7 +5,7 @@
#define NUKI_HUB_VERSION "9.07" #define NUKI_HUB_VERSION "9.07"
#define NUKI_HUB_VERSION_INT (uint32_t)907 #define NUKI_HUB_VERSION_INT (uint32_t)907
#define NUKI_HUB_BUILD "unknownbuildnr" #define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2025-01-07" #define NUKI_HUB_DATE "2025-01-08"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json" #define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"

View File

@@ -404,10 +404,6 @@ bool NukiNetwork::update()
_device->mqttDisconnect(true); _device->mqttDisconnect(true);
} }
if(!_webEnabled)
{
forceEnableWebServer = true;
}
if(_restartOnDisconnect && espMillis() > 60000) if(_restartOnDisconnect && espMillis() > 60000)
{ {
restartEsp(RestartReason::RestartOnDisconnectWatchdog); restartEsp(RestartReason::RestartOnDisconnectWatchdog);
@@ -926,7 +922,7 @@ void NukiNetwork::onMqttDataReceived(const char* topic, byte* payload, const uns
delay(200); delay(200);
restartEsp(RestartReason::RequestedViaMqtt); restartEsp(RestartReason::RequestedViaMqtt);
} }
else if(comparePrefixedPath(topic, mqtt_topic_update) && strcmp(data, "1") == 0 && _preferences->getBool(preference_update_from_mqtt, false)) else if(comparePrefixedPath(topic, mqtt_topic_update) && strcmp(data, "1") == 0 && _preferences->getBool(preference_update_from_mqtt, false) && !mqttRecentlyConnected())
{ {
Log->println(("Update requested via MQTT.")); Log->println(("Update requested via MQTT."));
@@ -1031,7 +1027,7 @@ void NukiNetwork::onMqttDataReceived(const char* topic, byte* payload, const uns
Log->println(("Failed to retrieve OTA manifest, OTA update aborted.")); Log->println(("Failed to retrieve OTA manifest, OTA update aborted."));
} }
} }
else if(comparePrefixedPath(topic, mqtt_topic_webserver_action)) else if(comparePrefixedPath(topic, mqtt_topic_webserver_action) && !mqttRecentlyConnected())
{ {
if(strcmp(data, "") == 0 || if(strcmp(data, "") == 0 ||
strcmp(data, "--") == 0) strcmp(data, "--") == 0)
@@ -1047,7 +1043,6 @@ void NukiNetwork::onMqttDataReceived(const char* topic, byte* payload, const uns
} }
Log->println(("Webserver enabled, restarting.")); Log->println(("Webserver enabled, restarting."));
_preferences->putBool(preference_webserver_enabled, true); _preferences->putBool(preference_webserver_enabled, true);
} }
else if (strcmp(data, "0") == 0) else if (strcmp(data, "0") == 0)
{ {
@@ -1058,7 +1053,6 @@ void NukiNetwork::onMqttDataReceived(const char* topic, byte* payload, const uns
Log->println(("Webserver disabled, restarting.")); Log->println(("Webserver disabled, restarting."));
_preferences->putBool(preference_webserver_enabled, false); _preferences->putBool(preference_webserver_enabled, false);
} }
clearWifiFallback(); clearWifiFallback();
delay(200); delay(200);
restartEsp(RestartReason::ReconfigureWebServer); restartEsp(RestartReason::ReconfigureWebServer);