From 1b668f8e710d2d7a4b3c84ca73cc9a7e296f17c7 Mon Sep 17 00:00:00 2001 From: iranl Date: Thu, 23 Jan 2025 22:07:12 +0100 Subject: [PATCH] Fix undefined availability --- src/Config.h | 2 +- src/NukiOpenerWrapper.cpp | 9 +++++++++ src/NukiWrapper.cpp | 9 ++++++++- src/WebCfgServer.cpp | 3 ++- src/WebCfgServerConstants.h | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Config.h b/src/Config.h index f9ebbbc..72dfd8a 100644 --- a/src/Config.h +++ b/src/Config.h @@ -5,7 +5,7 @@ #define NUKI_HUB_VERSION "9.08" #define NUKI_HUB_VERSION_INT (uint32_t)908 #define NUKI_HUB_BUILD "unknownbuildnr" -#define NUKI_HUB_DATE "2025-01-22" +#define NUKI_HUB_DATE "2025-01-23" #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" diff --git a/src/NukiOpenerWrapper.cpp b/src/NukiOpenerWrapper.cpp index a7d37b1..28552f6 100644 --- a/src/NukiOpenerWrapper.cpp +++ b/src/NukiOpenerWrapper.cpp @@ -476,6 +476,7 @@ bool NukiOpenerWrapper::updateKeyTurnerState() Log->println("ms"); _nextLockStateUpdateTs = espMillis() + _retryDelay; } + _network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState); return false; } _retryLockstateCount = 0; @@ -513,6 +514,14 @@ bool NukiOpenerWrapper::updateKeyTurnerState() updateAuthData(false); Log->println(("Done publishing auth data")); } + + if(_keyTurnerState.lockState == NukiOpener::LockState::Undefined) + { + if (_nextLockStateUpdateTs > espMillis() + 60000) + { + _nextLockStateUpdateTs = espMillis() + 60000; + } + } updateGpioOutputs(); _network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState); diff --git a/src/NukiWrapper.cpp b/src/NukiWrapper.cpp index f2515f5..e6b8a6a 100644 --- a/src/NukiWrapper.cpp +++ b/src/NukiWrapper.cpp @@ -513,6 +513,7 @@ bool NukiWrapper::updateKeyTurnerState() Log->println("ms"); _nextLockStateUpdateTs = espMillis() + _retryDelay; } + _network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState); return false; } @@ -545,7 +546,13 @@ bool NukiWrapper::updateKeyTurnerState() updateStatus = true; Log->println(("Lock: Keep updating status on intermediate lock state")); } - + else if(lockState == NukiLock::LockState::Undefined) + { + if (_nextLockStateUpdateTs > espMillis() + 60000) + { + _nextLockStateUpdateTs = espMillis() + 60000; + } + } _network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState); char lockStateStr[20]; diff --git a/src/WebCfgServer.cpp b/src/WebCfgServer.cpp index c9b40ac..96a6375 100644 --- a/src/WebCfgServer.cpp +++ b/src/WebCfgServer.cpp @@ -5002,6 +5002,7 @@ esp_err_t WebCfgServer::buildHtml(PsychicRequest *request, PsychicResponse* resp printParameter(&response, "Latest Firmware", _preferences->getString(preference_latest_version).c_str(), "/get?page=ota", "ota"); } response.print("
"); + response.print("