Merge remote-tracking branch 'upstream/master' into http-server
This commit is contained in:
15
src/Config.h
15
src/Config.h
@@ -23,6 +23,20 @@
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32c3.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32c3.bin"
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#if defined(CONFIG_SPIRAM_MODE_OCT)
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3oct.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_BETA_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_updater_esp32s3oct.bin"
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/master/nuki_hub_updater_esp32s3oct.bin"
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/nuki_hub_updater_esp32s3oct.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32s3oct.bin"
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32s3oct.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32s3oct.bin"
|
||||
#else
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32s3.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32s3.bin"
|
||||
#define GITHUB_BETA_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/beta/nuki_hub_esp32s3.bin"
|
||||
@@ -35,6 +49,7 @@
|
||||
#define GITHUB_BETA_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/beta/nuki_hub_updater_esp32s3.bin"
|
||||
#define GITHUB_MASTER_RELEASE_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_esp32s3.bin"
|
||||
#define GITHUB_MASTER_UPDATER_BINARY_URL_DBG (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/debug/master/nuki_hub_updater_esp32s3.bin"
|
||||
#endif
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C6)
|
||||
#define GITHUB_LATEST_RELEASE_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_esp32c6.bin"
|
||||
#define GITHUB_LATEST_UPDATER_BINARY_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/nuki_hub_updater_esp32c6.bin"
|
||||
|
||||
@@ -256,10 +256,10 @@ void NukiOpenerWrapper::update()
|
||||
|
||||
if(_nextLockAction != (NukiOpener::LockAction)0xff)
|
||||
{
|
||||
_retryCount = 0;
|
||||
Nuki::CmdResult cmdResult;
|
||||
int retryCount = 0;
|
||||
Nuki::CmdResult cmdResult = (Nuki::CmdResult)-1;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
||||
while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
||||
{
|
||||
cmdResult = _nukiOpener.lockAction(_nextLockAction, 0, 0);
|
||||
char resultStr[15] = {0};
|
||||
@@ -275,15 +275,15 @@ void NukiOpenerWrapper::update()
|
||||
Log->print(F("Opener: Last command failed, retrying after "));
|
||||
Log->print(_retryDelay);
|
||||
Log->print(F(" milliseconds. Retry "));
|
||||
Log->print(_retryCount + 1);
|
||||
Log->print(retryCount + 1);
|
||||
Log->print(" of ");
|
||||
Log->println(_nrOfRetries);
|
||||
|
||||
_network->publishRetry(std::to_string(_retryCount + 1));
|
||||
_network->publishRetry(std::to_string(retryCount + 1));
|
||||
|
||||
delay(_retryDelay);
|
||||
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
postponeBleWatchdog();
|
||||
}
|
||||
@@ -292,14 +292,14 @@ void NukiOpenerWrapper::update()
|
||||
{
|
||||
_nextLockAction = (NukiOpener::LockAction) 0xff;
|
||||
_network->publishRetry("--");
|
||||
_retryCount = 0;
|
||||
retryCount = 0;
|
||||
if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log->println(F("Opener: Maximum number of retries exceeded, aborting."));
|
||||
_network->publishRetry("failed");
|
||||
_retryCount = 0;
|
||||
retryCount = 0;
|
||||
_nextLockAction = (NukiOpener::LockAction) 0xff;
|
||||
}
|
||||
}
|
||||
@@ -380,17 +380,15 @@ void NukiOpenerWrapper::unpair()
|
||||
void NukiOpenerWrapper::updateKeyTurnerState()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(result != Nuki::CmdResult::Success && retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying opener state: "));
|
||||
Log->print(F("Result (attempt "));
|
||||
Log->print(retryCount + 1);
|
||||
Log->print("): ");
|
||||
result =_nukiOpener.requestOpenerState(&_keyTurnerState);
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
}
|
||||
else break;
|
||||
++retryCount;
|
||||
}
|
||||
|
||||
char resultStr[15];
|
||||
@@ -455,15 +453,15 @@ void NukiOpenerWrapper::updateKeyTurnerState()
|
||||
void NukiOpenerWrapper::updateBatteryState()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying opener battery state: "));
|
||||
result = _nukiOpener.requestBatteryReport(&_batteryReport);
|
||||
delay(250);
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -511,15 +509,15 @@ void NukiOpenerWrapper::updateConfig()
|
||||
|
||||
if(isPinSet()) {
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
Log->println(F("Nuki opener PIN is set"));
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiOpener.verifySecurityPin();
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -599,15 +597,15 @@ void NukiOpenerWrapper::updateAuthData(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Retrieve log entries: "));
|
||||
result = _nukiOpener.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -672,15 +670,15 @@ void NukiOpenerWrapper::updateKeypad(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying opener keypad: "));
|
||||
result = _nukiOpener.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -739,15 +737,15 @@ void NukiOpenerWrapper::updateTimeControl(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying opener timecontrol: "));
|
||||
result = _nukiOpener.retrieveTimeControlEntries();
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -800,15 +798,15 @@ void NukiOpenerWrapper::updateAuth(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries)
|
||||
while(retryCount < _nrOfRetries)
|
||||
{
|
||||
Log->print(F("Querying opener authorization: "));
|
||||
result = _nukiOpener.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
||||
delay(250);
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1098,9 +1096,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
if((int)_basicOpenerConfigAclPrefs[i] == 1)
|
||||
{
|
||||
cmdResult = Nuki::CmdResult::Error;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(basicKeys[i], "name") == 0)
|
||||
{
|
||||
@@ -1256,7 +1254,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
}
|
||||
|
||||
if(cmdResult != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1288,9 +1286,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
if((int)_advancedOpenerConfigAclPrefs[j] == 1)
|
||||
{
|
||||
cmdResult = Nuki::CmdResult::Error;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(advancedKeys[j], "intercomID") == 0)
|
||||
{
|
||||
@@ -1513,8 +1511,9 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
else jsonResult[advancedKeys[j]] = "invalidValue";
|
||||
}
|
||||
|
||||
if(cmdResult != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
if(cmdResult != Nuki::CmdResult::Success)
|
||||
{
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1614,9 +1613,9 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
|
||||
int codeInt = code.toInt();
|
||||
bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1);
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(command, "add") == 0)
|
||||
{
|
||||
@@ -1705,7 +1704,7 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1799,9 +1798,9 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(idExists)
|
||||
@@ -2151,7 +2150,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2238,9 +2237,9 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(idExists)
|
||||
@@ -2377,7 +2376,7 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2471,11 +2470,12 @@ void NukiOpenerWrapper::onAuthCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries)
|
||||
while(retryCount < _nrOfRetries)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(strcmp(action, "delete") == 0)
|
||||
{
|
||||
if(idExists)
|
||||
{
|
||||
result = _nukiOpener.deleteAuthorizationEntry(authId);
|
||||
@@ -2835,7 +2835,7 @@ void NukiOpenerWrapper::onAuthCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2895,15 +2895,15 @@ void NukiOpenerWrapper::notify(Nuki::EventType eventType)
|
||||
void NukiOpenerWrapper::readConfig()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiOpener.requestConfig(&_nukiConfig);
|
||||
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
||||
|
||||
if(!_nukiConfigValid) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2921,15 +2921,15 @@ void NukiOpenerWrapper::readConfig()
|
||||
void NukiOpenerWrapper::readAdvancedConfig()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiOpener.requestAdvancedConfig(&_nukiAdvancedConfig);
|
||||
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
|
||||
|
||||
if(!_nukiAdvancedConfigValid) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ private:
|
||||
bool _disableNonJSON = false;
|
||||
int _nrOfRetries = 0;
|
||||
int _retryDelay = 0;
|
||||
int _retryCount = 0;
|
||||
int _retryConfigCount = 0;
|
||||
int _retryLockstateCount = 0;
|
||||
int64_t _nextRetryTs = 0;
|
||||
|
||||
@@ -257,10 +257,10 @@ void NukiWrapper::update()
|
||||
}
|
||||
if(_nextLockAction != (NukiLock::LockAction)0xff)
|
||||
{
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
Nuki::CmdResult cmdResult;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
||||
while(retryCount < _nrOfRetries + 1 && cmdResult != Nuki::CmdResult::Success)
|
||||
{
|
||||
cmdResult = _nukiLock.lockAction(_nextLockAction, 0, 0);
|
||||
char resultStr[15] = {0};
|
||||
@@ -275,15 +275,15 @@ void NukiWrapper::update()
|
||||
Log->print(F("Lock: Last command failed, retrying after "));
|
||||
Log->print(_retryDelay);
|
||||
Log->print(F(" milliseconds. Retry "));
|
||||
Log->print(_retryCount + 1);
|
||||
Log->print(retryCount + 1);
|
||||
Log->print(" of ");
|
||||
Log->println(_nrOfRetries);
|
||||
|
||||
_network->publishRetry(std::to_string(_retryCount + 1));
|
||||
_network->publishRetry(std::to_string(retryCount + 1));
|
||||
|
||||
delay(_retryDelay);
|
||||
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
postponeBleWatchdog();
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void NukiWrapper::update()
|
||||
{
|
||||
_nextLockAction = (NukiLock::LockAction) 0xff;
|
||||
_network->publishRetry("--");
|
||||
_retryCount = 0;
|
||||
retryCount = 0;
|
||||
if(!_network->_offConnected) _statusUpdated = true; Log->println(F("Lock: updating status after action"));
|
||||
_statusUpdatedTs = ts;
|
||||
if(_intervalLockstate > 10) _nextLockStateUpdateTs = ts + 10 * 1000;
|
||||
@@ -301,7 +301,7 @@ void NukiWrapper::update()
|
||||
{
|
||||
Log->println(F("Lock: Maximum number of retries exceeded, aborting."));
|
||||
_network->publishRetry("failed");
|
||||
_retryCount = 0;
|
||||
retryCount = 0;
|
||||
_nextLockAction = (NukiLock::LockAction) 0xff;
|
||||
}
|
||||
}
|
||||
@@ -443,20 +443,17 @@ void NukiWrapper::unpair()
|
||||
void NukiWrapper::updateKeyTurnerState()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
Log->println("Querying lock state");
|
||||
Log->println(F("Querying lock state"));
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(result != Nuki::CmdResult::Success && retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Result (attempt "));
|
||||
Log->print(_retryCount + 1);
|
||||
Log->print("): ");
|
||||
Log->print(retryCount + 1);
|
||||
Log->print(F("): "));
|
||||
result =_nukiLock.requestKeyTurnerState(&_keyTurnerState);
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
}
|
||||
else break;
|
||||
++retryCount;
|
||||
}
|
||||
|
||||
char resultStr[15];
|
||||
@@ -519,19 +516,19 @@ void NukiWrapper::updateKeyTurnerState()
|
||||
void NukiWrapper::updateBatteryState()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
Log->println("Querying lock battery state");
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Result (attempt "));
|
||||
Log->print(_retryCount + 1);
|
||||
Log->print(retryCount + 1);
|
||||
Log->print("): ");
|
||||
result = _nukiLock.requestBatteryReport(&_batteryReport);
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -578,14 +575,14 @@ void NukiWrapper::updateConfig()
|
||||
|
||||
if(isPinSet()) {
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
Log->println(F("Nuki Lock PIN is set"));
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiLock.verifySecurityPin();
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -665,14 +662,14 @@ void NukiWrapper::updateAuthData(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Retrieve log entries: "));
|
||||
result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -736,14 +733,14 @@ void NukiWrapper::updateKeypad(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying lock keypad: "));
|
||||
result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -802,14 +799,14 @@ void NukiWrapper::updateTimeControl(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
Log->print(F("Querying lock timecontrol: "));
|
||||
result = _nukiLock.retrieveTimeControlEntries();
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -862,15 +859,15 @@ void NukiWrapper::updateAuth(bool retrieved)
|
||||
if(!retrieved)
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries)
|
||||
while(retryCount < _nrOfRetries)
|
||||
{
|
||||
Log->print(F("Querying lock authorization: "));
|
||||
result = _nukiLock.retrieveAuthorizationEntries(0, _preferences->getInt(preference_auth_max_entries, MAX_AUTH));
|
||||
delay(250);
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1289,9 +1286,9 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
if((int)_basicLockConfigaclPrefs[i] == 1)
|
||||
{
|
||||
cmdResult = Nuki::CmdResult::Error;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(basicKeys[i], "name") == 0)
|
||||
{
|
||||
@@ -1469,7 +1466,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
}
|
||||
|
||||
if(cmdResult != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1501,9 +1498,9 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
if((int)_advancedLockConfigaclPrefs[j] == 1)
|
||||
{
|
||||
cmdResult = Nuki::CmdResult::Error;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(advancedKeys[j], "unlockedPositionOffsetDegrees") == 0)
|
||||
{
|
||||
@@ -1753,7 +1750,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
}
|
||||
|
||||
if(cmdResult != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -1880,9 +1877,9 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
|
||||
int codeInt = code.toInt();
|
||||
bool codeValid = codeInt > 100000 && codeInt < 1000000 && (code.indexOf('0') == -1);
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(command, "add") == 0)
|
||||
{
|
||||
@@ -1971,7 +1968,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2065,9 +2062,9 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(idExists)
|
||||
@@ -2417,7 +2414,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2504,9 +2501,9 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(idExists)
|
||||
@@ -2645,7 +2642,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -2739,9 +2736,9 @@ void NukiWrapper::onAuthCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries)
|
||||
while(retryCount < _nrOfRetries)
|
||||
{
|
||||
if(strcmp(action, "delete") == 0) {
|
||||
if(idExists)
|
||||
@@ -3106,7 +3103,7 @@ void NukiWrapper::onAuthCommandReceived(const char *value)
|
||||
}
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
@@ -3169,9 +3166,9 @@ void NukiWrapper::notify(Nuki::EventType eventType)
|
||||
void NukiWrapper::readConfig()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiLock.requestConfig(&_nukiConfig);
|
||||
_nukiConfigValid = result == Nuki::CmdResult::Success;
|
||||
@@ -3182,7 +3179,7 @@ void NukiWrapper::readConfig()
|
||||
Log->println(resultStr);
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
Log->println("Failed to retrieve lock config, retrying in 1s");
|
||||
delay(1000);
|
||||
}
|
||||
@@ -3193,9 +3190,9 @@ void NukiWrapper::readConfig()
|
||||
void NukiWrapper::readAdvancedConfig()
|
||||
{
|
||||
Nuki::CmdResult result = (Nuki::CmdResult)-1;
|
||||
_retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
while(_retryCount < _nrOfRetries + 1)
|
||||
while(retryCount < _nrOfRetries + 1)
|
||||
{
|
||||
result = _nukiLock.requestAdvancedConfig(&_nukiAdvancedConfig);
|
||||
_nukiAdvancedConfigValid = result == Nuki::CmdResult::Success;
|
||||
@@ -3206,7 +3203,7 @@ void NukiWrapper::readAdvancedConfig()
|
||||
Log->println(resultStr);
|
||||
|
||||
if(result != Nuki::CmdResult::Success) {
|
||||
++_retryCount;
|
||||
++retryCount;
|
||||
Log->println("Failed to retrieve lock advanced config, retrying in 1s");
|
||||
delay(1000);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,6 @@ private:
|
||||
uint _maxAuthEntryCount = 0;
|
||||
int _nrOfRetries = 0;
|
||||
int _retryDelay = 0;
|
||||
int _retryCount = 0;
|
||||
int _retryConfigCount = 0;
|
||||
int _retryLockstateCount = 0;
|
||||
int _rssiPublishInterval = 0;
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include "Logger.h"
|
||||
#include "RestartReason.h"
|
||||
#include <esp_task_wdt.h>
|
||||
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
|
||||
#include <esp_psram.h>
|
||||
#endif
|
||||
#ifndef CONFIG_IDF_TARGET_ESP32H2
|
||||
#include <esp_wifi.h>
|
||||
#endif
|
||||
@@ -3128,7 +3131,6 @@ esp_err_t WebCfgServer::buildAccLvlHtml(PsychicRequest *request)
|
||||
response.print("</table><br>");
|
||||
response.print("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");
|
||||
}
|
||||
|
||||
response.print("</form>");
|
||||
response.print("</body></html>");
|
||||
return response.endSend();
|
||||
@@ -3265,8 +3267,28 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request)
|
||||
response.print(getRestartReason());
|
||||
response.print("\nLast restart reason ESP: ");
|
||||
response.print(getEspRestartReason());
|
||||
response.print("\nFree heap: ");
|
||||
response.print(esp_get_free_heap_size());
|
||||
response.print("\nFree internal heap: ");
|
||||
response.print(ESP.getFreeHeap());
|
||||
response.print("\nTotal internal heap: ");
|
||||
response.print(ESP.getHeapSize());
|
||||
#ifdef CONFIG_SOC_SPIRAM_SUPPORTED
|
||||
if(esp_psram_get_size() > 0)
|
||||
{
|
||||
response.print("\nPSRAM Available: Yes");
|
||||
response.print("\nTotal PSRAM: ");
|
||||
response.print(esp_psram_get_size());
|
||||
response.print("\nFree PSRAM: ");
|
||||
response.print((esp_get_free_heap_size() - ESP.getFreeHeap()));
|
||||
response.print("\nTotal free heap: ");
|
||||
response.print(esp_get_free_heap_size());
|
||||
}
|
||||
else
|
||||
{
|
||||
response.print("\nPSRAM Available: No");
|
||||
}
|
||||
#else
|
||||
response.print("\nPSRAM Available: No");
|
||||
#endif
|
||||
response.print("\nNetwork task stack high watermark: ");
|
||||
response.print(uxTaskGetStackHighWaterMark(networkTaskHandle));
|
||||
response.print("\nNuki task stack high watermark: ");
|
||||
|
||||
@@ -520,6 +520,13 @@ void setup()
|
||||
|
||||
if(doOta) setupTasks(true);
|
||||
else setupTasks(false);
|
||||
|
||||
#ifdef DEBUG_NUKIHUB
|
||||
Log->print("Task Name\tStatus\tPrio\tHWM\tTask\tAffinity\n");
|
||||
char stats_buffer[1024];
|
||||
vTaskList(stats_buffer);
|
||||
Log->println(stats_buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop()
|
||||
|
||||
Reference in New Issue
Block a user