diff --git a/NukiWrapper.cpp b/NukiWrapper.cpp index 99c46ff..a589578 100644 --- a/NukiWrapper.cpp +++ b/NukiWrapper.cpp @@ -171,7 +171,7 @@ void NukiWrapper::update() updateKeypad(); } - if(_nextLockAction != (NukiLock::LockAction)0xff) + if(_nextLockAction != (NukiLock::LockAction)0xff && ts > _nextRetryTs) { Nuki::CmdResult cmdResult = _nukiLock.lockAction(_nextLockAction, 0, 0); @@ -187,6 +187,7 @@ void NukiWrapper::update() { _retryCount = 0; _nextLockAction = (NukiLock::LockAction) 0xff; + _network->publishRetry("--"); if (_intervalLockstate > 10) { _nextLockStateUpdateTs = ts + 10 * 1000; @@ -205,7 +206,7 @@ void NukiWrapper::update() _network->publishRetry(std::to_string(_retryCount + 1)); - _nextLockStateUpdateTs = millis() + _retryDelay; + _nextRetryTs = millis() + _retryDelay; ++_retryCount; } @@ -214,6 +215,7 @@ void NukiWrapper::update() Log->println(F("Maximum number of retries exceeded, aborting.")); _network->publishRetry("failed"); _retryCount = 0; + _nextRetryTs = 0; _nextLockAction = (NukiLock::LockAction) 0xff; } } diff --git a/NukiWrapper.h b/NukiWrapper.h index f343252..70791f6 100644 --- a/NukiWrapper.h +++ b/NukiWrapper.h @@ -87,6 +87,7 @@ private: int _nrOfRetries = 0; int _retryDelay = 0; int _retryCount = 0; + unsigned long _nextRetryTs = 0; unsigned long _nextLockStateUpdateTs = 0; unsigned long _nextBatteryReportTs = 0; unsigned long _nextConfigUpdateTs = 0; diff --git a/Version.h b/Version.h index 222ae51..d7cd96c 100644 --- a/Version.h +++ b/Version.h @@ -1,3 +1,3 @@ #pragma once -#define nuki_hub_version "6.10-retry-2" \ No newline at end of file +#define nuki_hub_version "6.10-retry-3" \ No newline at end of file