This commit is contained in:
iranl
2024-05-15 20:44:17 +02:00
3 changed files with 52 additions and 23 deletions

View File

@@ -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;

View File

@@ -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)
@@ -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));
@@ -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;
@@ -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;

View File

@@ -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)