Publish keypad code and rolling log

This commit is contained in:
iranl
2024-05-30 19:36:23 +02:00
parent ff741f7989
commit 58ec4b345c
17 changed files with 213 additions and 131 deletions

View File

@@ -496,12 +496,14 @@ void NukiWrapper::updateAuthData(bool retrieved)
std::list<NukiLock::LogEntry> log;
_nukiLock.getLogEntries(&log);
if(log.size() > _preferences->getInt(preference_authlog_max_entries, 3))
{
log.resize(_preferences->getInt(preference_authlog_max_entries, 3));
}
log.sort([](const NukiLock::LogEntry& a, const NukiLock::LogEntry& b) { return a.index < b.index; });
if(log.size() > 0)
{
_network->publishAuthorizationInfo(log, true);
@@ -517,6 +519,8 @@ void NukiWrapper::updateAuthData(bool retrieved)
{
log.resize(_preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG));
}
log.sort([](const NukiLock::LogEntry& a, const NukiLock::LogEntry& b) { return a.index < b.index; });
Log->print(F("Log size: "));
Log->println(log.size());