Update Tasks

This commit is contained in:
iranl
2024-05-22 21:10:15 +02:00
parent 87edff8312
commit 699d9a148a
9 changed files with 138 additions and 84 deletions

View File

@@ -466,7 +466,7 @@ void NukiWrapper::updateAuthData()
return;
}
Nuki::CmdResult result = _nukiLock.retrieveLogEntries(0, 5, 1, false);
Nuki::CmdResult result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, 5), 1, false);
Log->print(F("Retrieve log entries: "));
Log->println(result);
if(result != Nuki::CmdResult::Success)
@@ -474,10 +474,15 @@ void NukiWrapper::updateAuthData()
return;
}
delay(100);
delay(_preferences->getInt(preference_authlog_max_entries, 5) * 30);
std::list<NukiLock::LogEntry> log;
_nukiLock.getLogEntries(&log);
if(log.size() > _preferences->getInt(preference_authlog_max_entries, 5))
{
log.resize(_preferences->getInt(preference_authlog_max_entries, 5));
}
Log->print(F("Log size: "));
Log->println(log.size());
@@ -494,7 +499,7 @@ void NukiWrapper::updateKeypad()
if(!_preferences->getBool(preference_keypad_info_enabled)) return;
Log->print(F("Querying lock keypad: "));
Nuki::CmdResult result = _nukiLock.retrieveKeypadEntries(0, 0xffff);
Nuki::CmdResult result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, 10));
printCommandResult(result);
if(result == Nuki::CmdResult::Success)
{
@@ -505,6 +510,11 @@ void NukiWrapper::updateKeypad()
Log->println(entries.size());
entries.sort([](const NukiLock::KeypadEntry& a, const NukiLock::KeypadEntry& b) { return a.codeId < b.codeId; });
if(entries.size() > _preferences->getInt(preference_keypad_max_entries, 10))
{
entries.resize(_preferences->getInt(preference_keypad_max_entries, 10));
}
uint keypadCount = entries.size();
if(keypadCount > _maxKeypadCodeCount)
@@ -552,7 +562,12 @@ void NukiWrapper::updateTimeControl(bool retrieved)
Log->println(timeControlEntries.size());
timeControlEntries.sort([](const NukiLock::TimeControlEntry& a, const NukiLock::TimeControlEntry& b) { return a.entryId < b.entryId; });
if(timeControlEntries.size() > _preferences->getInt(preference_timecontrol_max_entries, 10))
{
timeControlEntries.resize(_preferences->getInt(preference_timecontrol_max_entries, 10));
}
_network->publishTimeControl(timeControlEntries);
_timeControlIds.clear();