implement retry for keyturner state

This commit is contained in:
technyon
2023-02-10 17:06:52 +01:00
parent 8e16b3e7b2
commit 11caec34cd
4 changed files with 27 additions and 2 deletions

View File

@@ -283,7 +283,19 @@ void NukiWrapper::unpair()
void NukiWrapper::updateKeyTurnerState()
{
_nukiLock.requestKeyTurnerState(&_keyTurnerState);
Nuki::CmdResult result =_nukiLock.requestKeyTurnerState(&_keyTurnerState);
if(result != Nuki::CmdResult::Success)
{
_retryLockstateCount++;
postponeBleWatchdog();
if(_retryLockstateCount < _nrOfRetries)
{
_nextLockStateUpdateTs = millis() + _retryDelay;
}
return;
}
_retryLockstateCount = 0;
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
if(_keyTurnerState.lockState != _lastKeyTurnerState.lockState)