Merge branch 'master' of https://github.com/iranl/nuki_hub
This commit is contained in:
@@ -469,7 +469,7 @@ void NukiOpenerWrapper::updateConfig()
|
||||
|
||||
void NukiOpenerWrapper::updateAuthData()
|
||||
{
|
||||
if(_nukiOpener.getSecurityPincode() == 0) return;
|
||||
if(!isPinSet()) return;
|
||||
|
||||
Nuki::CmdResult result = _nukiOpener.retrieveLogEntries(0, 0, 0, true);
|
||||
if(result != Nuki::CmdResult::Success)
|
||||
@@ -767,10 +767,19 @@ Nuki::BatteryType NukiOpenerWrapper::batteryTypeToEnum(const char* str)
|
||||
|
||||
void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
{
|
||||
|
||||
JsonDocument jsonResult;
|
||||
char _resbuf[2048];
|
||||
|
||||
if(_nukiOpener.getSecurityPincode() == 0)
|
||||
if(!_configRead || !_nukiConfigValid)
|
||||
{
|
||||
jsonResult["general"] = "configNotReady";
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
_network->publishConfigCommandResult(_resbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isPinSet())
|
||||
{
|
||||
jsonResult["general"] = "noPinSet";
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
@@ -1402,7 +1411,7 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
|
||||
|
||||
void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
{
|
||||
if(_nukiOpener.getSecurityPincode() == 0)
|
||||
if(!isPinSet())
|
||||
{
|
||||
_network->publishKeypadJsonCommandResult("noPinSet");
|
||||
return;
|
||||
@@ -1744,7 +1753,13 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
|
||||
void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
||||
{
|
||||
if(_nukiOpener.getSecurityPincode() == 0)
|
||||
if(!_configRead || !_nukiConfigValid)
|
||||
{
|
||||
_network->publishTimeControlCommandResult("configNotReady");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isPinSet())
|
||||
{
|
||||
_network->publishTimeControlCommandResult("noPinSet");
|
||||
return;
|
||||
|
||||
@@ -450,7 +450,7 @@ void NukiWrapper::updateConfig()
|
||||
|
||||
void NukiWrapper::updateAuthData()
|
||||
{
|
||||
if(_nukiLock.getSecurityPincode() == 0) return;
|
||||
if(!isPinSet()) return;
|
||||
|
||||
Nuki::CmdResult result = _nukiLock.retrieveLogEntries(0, 0, 0, true);
|
||||
if(result != Nuki::CmdResult::Success)
|
||||
@@ -489,7 +489,7 @@ void NukiWrapper::updateKeypad()
|
||||
{
|
||||
std::list<NukiLock::KeypadEntry> entries;
|
||||
_nukiLock.getKeypadEntries(&entries);
|
||||
|
||||
|
||||
Log->print(F("Lock keypad codes: "));
|
||||
Log->println(entries.size());
|
||||
|
||||
@@ -533,7 +533,7 @@ void NukiWrapper::updateTimeControl(bool retrieved)
|
||||
{
|
||||
std::list<NukiLock::TimeControlEntry> timeControlEntries;
|
||||
_nukiLock.getTimeControlEntries(&timeControlEntries);
|
||||
|
||||
|
||||
Log->print(F("Lock time control entries: "));
|
||||
Log->println(timeControlEntries.size());
|
||||
|
||||
@@ -548,7 +548,7 @@ void NukiWrapper::updateTimeControl(bool retrieved)
|
||||
_timeControlIds.push_back(entry.entryId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
postponeBleWatchdog();
|
||||
}
|
||||
|
||||
@@ -574,13 +574,13 @@ NukiLock::LockAction NukiWrapper::lockActionToEnum(const char *str)
|
||||
LockActionResult NukiWrapper::onLockActionReceivedCallback(const char *value)
|
||||
{
|
||||
NukiLock::LockAction action;
|
||||
|
||||
|
||||
if(value)
|
||||
{
|
||||
if(strlen(value) > 0)
|
||||
{
|
||||
action = nukiInst->lockActionToEnum(value);
|
||||
|
||||
|
||||
if((int)action == 0xff)
|
||||
{
|
||||
return LockActionResult::UnknownAction;
|
||||
@@ -589,7 +589,7 @@ LockActionResult NukiWrapper::onLockActionReceivedCallback(const char *value)
|
||||
else return LockActionResult::UnknownAction;
|
||||
}
|
||||
else return LockActionResult::UnknownAction;
|
||||
|
||||
|
||||
nukiLockPreferences = new Preferences();
|
||||
nukiLockPreferences->begin("nukihub", true);
|
||||
uint32_t aclPrefs[17];
|
||||
@@ -707,7 +707,15 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
JsonDocument jsonResult;
|
||||
char _resbuf[2048];
|
||||
|
||||
if(_nukiLock.getSecurityPincode() == 0)
|
||||
if(!_configRead || !_nukiConfigValid)
|
||||
{
|
||||
jsonResult["general"] = "configNotReady";
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
_network->publishConfigCommandResult(_resbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isPinSet())
|
||||
{
|
||||
jsonResult["general"] = "noPinSet";
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
@@ -744,7 +752,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
if(json[basicKeys[i]])
|
||||
{
|
||||
const char *jsonchar = json[basicKeys[i]].as<const char*>();
|
||||
|
||||
|
||||
if(strlen(jsonchar) == 0)
|
||||
{
|
||||
jsonResult[basicKeys[i]] = "noValueSet";
|
||||
@@ -947,7 +955,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
if(json[advancedKeys[i]])
|
||||
{
|
||||
const char *jsonchar = json[advancedKeys[i]].as<const char*>();
|
||||
|
||||
|
||||
if(strlen(jsonchar) == 0)
|
||||
{
|
||||
jsonResult[advancedKeys[i]] = "noValueSet";
|
||||
@@ -1389,7 +1397,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
|
||||
|
||||
void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
{
|
||||
if(_nukiLock.getSecurityPincode() == 0)
|
||||
if(!isPinSet())
|
||||
{
|
||||
_network->publishKeypadJsonCommandResult("noPinSet");
|
||||
return;
|
||||
@@ -1651,13 +1659,13 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
_network->publishKeypadJsonCommandResult("noCodeIdSet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!idExists)
|
||||
{
|
||||
_network->publishKeypadJsonCommandResult("noExistingCodeIdSet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NukiLock::UpdatedKeypadEntry entry;
|
||||
memset(&entry, 0, sizeof(entry));
|
||||
entry.codeId = codeId;
|
||||
@@ -1731,7 +1739,13 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
||||
|
||||
void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
{
|
||||
if(_nukiLock.getSecurityPincode() == 0)
|
||||
if(!_configRead || !_nukiConfigValid)
|
||||
{
|
||||
_network->publishTimeControlCommandResult("configNotReady");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isPinSet())
|
||||
{
|
||||
_network->publishTimeControlCommandResult("noPinSet");
|
||||
return;
|
||||
@@ -1772,7 +1786,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(action)
|
||||
{
|
||||
bool idExists = false;
|
||||
@@ -1861,7 +1875,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
_network->publishTimeControlCommandResult("noExistingEntryIdSet");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NukiLock::TimeControlEntry entry;
|
||||
memset(&entry, 0, sizeof(entry));
|
||||
entry.entryId = entryId;
|
||||
|
||||
@@ -112,9 +112,9 @@ void setupTasks()
|
||||
{
|
||||
// configMAX_PRIORITIES is 25
|
||||
|
||||
xTaskCreatePinnedToCore(networkTask, "ntw", 10240, NULL, 3, &networkTaskHandle, 1);
|
||||
xTaskCreatePinnedToCore(nukiTask, "nuki", 5120, NULL, 2, &nukiTaskHandle, 1);
|
||||
xTaskCreatePinnedToCore(presenceDetectionTask, "prdet", 896, NULL, 5, &presenceDetectionTaskHandle, 1);
|
||||
xTaskCreatePinnedToCore(networkTask, "ntw", 12288, NULL, 3, &networkTaskHandle, 1);
|
||||
xTaskCreatePinnedToCore(nukiTask, "nuki", 8192, NULL, 2, &nukiTaskHandle, 1);
|
||||
xTaskCreatePinnedToCore(presenceDetectionTask, "prdet", 1024, NULL, 5, &presenceDetectionTaskHandle, 1);
|
||||
}
|
||||
|
||||
void initEthServer(const NetworkDeviceType device)
|
||||
|
||||
Reference in New Issue
Block a user