Fix operator (#399)
This commit is contained in:
@@ -60,11 +60,11 @@ void NukiOpenerWrapper::initialize()
|
|||||||
_maxTimeControlEntryCount = _preferences->getUInt(preference_opener_max_timecontrol_entry_count);
|
_maxTimeControlEntryCount = _preferences->getUInt(preference_opener_max_timecontrol_entry_count);
|
||||||
_restartBeaconTimeout = _preferences->getInt(preference_restart_ble_beacon_lost);
|
_restartBeaconTimeout = _preferences->getInt(preference_restart_ble_beacon_lost);
|
||||||
_hassEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
_hassEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
||||||
_nrOfRetries = _preferences->getInt(preference_command_nr_of_retries);
|
_nrOfRetries = _preferences->getInt(preference_command_nr_of_retries, 200);
|
||||||
_retryDelay = _preferences->getInt(preference_command_retry_delay);
|
_retryDelay = _preferences->getInt(preference_command_retry_delay);
|
||||||
_rssiPublishInterval = _preferences->getInt(preference_rssi_publish_interval) * 1000;
|
_rssiPublishInterval = _preferences->getInt(preference_rssi_publish_interval) * 1000;
|
||||||
|
|
||||||
if(!_nrOfRetries > -1)
|
if(_nrOfRetries == 200)
|
||||||
{
|
{
|
||||||
_nrOfRetries = 3;
|
_nrOfRetries = 3;
|
||||||
_preferences->putInt(preference_command_nr_of_retries, _nrOfRetries);
|
_preferences->putInt(preference_command_nr_of_retries, _nrOfRetries);
|
||||||
@@ -451,7 +451,7 @@ void NukiOpenerWrapper::updateBatteryState()
|
|||||||
Log->print(F("Querying opener battery state: "));
|
Log->print(F("Querying opener battery state: "));
|
||||||
result = _nukiOpener.requestBatteryReport(&_batteryReport);
|
result = _nukiOpener.requestBatteryReport(&_batteryReport);
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -510,7 +510,7 @@ void NukiOpenerWrapper::updateConfig()
|
|||||||
_taskRunning = true;
|
_taskRunning = true;
|
||||||
result = _nukiOpener.verifySecurityPin();
|
result = _nukiOpener.verifySecurityPin();
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -593,7 +593,7 @@ void NukiOpenerWrapper::updateAuthData(bool retrieved)
|
|||||||
Log->print(F("Retrieve log entries: "));
|
Log->print(F("Retrieve log entries: "));
|
||||||
result = _nukiOpener.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
result = _nukiOpener.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -670,7 +670,7 @@ void NukiOpenerWrapper::updateKeypad(bool retrieved)
|
|||||||
Log->print(F("Querying opener keypad: "));
|
Log->print(F("Querying opener keypad: "));
|
||||||
result = _nukiOpener.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
result = _nukiOpener.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -741,7 +741,7 @@ void NukiOpenerWrapper::updateTimeControl(bool retrieved)
|
|||||||
Log->print(F("Querying opener time control: "));
|
Log->print(F("Querying opener time control: "));
|
||||||
result = _nukiOpener.retrieveTimeControlEntries();
|
result = _nukiOpener.retrieveTimeControlEntries();
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1187,7 +1187,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
{
|
{
|
||||||
Nuki::AdvertisingMode advmode = nukiOpenerInst->advertisingModeToEnum(jsonchar);
|
Nuki::AdvertisingMode advmode = nukiOpenerInst->advertisingModeToEnum(jsonchar);
|
||||||
|
|
||||||
if(!(int)advmode == 0xff)
|
if((int)advmode != 0xff)
|
||||||
{
|
{
|
||||||
if(_nukiConfig.advertisingMode == advmode) jsonResult[basicKeys[i]] = "unchanged";
|
if(_nukiConfig.advertisingMode == advmode) jsonResult[basicKeys[i]] = "unchanged";
|
||||||
else cmdResult = _nukiOpener.setAdvertisingMode(advmode);
|
else cmdResult = _nukiOpener.setAdvertisingMode(advmode);
|
||||||
@@ -1198,7 +1198,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
{
|
{
|
||||||
Nuki::TimeZoneId tzid = nukiOpenerInst->timeZoneToEnum(jsonchar);
|
Nuki::TimeZoneId tzid = nukiOpenerInst->timeZoneToEnum(jsonchar);
|
||||||
|
|
||||||
if(!(int)tzid == 0xff)
|
if((int)tzid != 0xff)
|
||||||
{
|
{
|
||||||
if(_nukiConfig.timeZoneId == tzid) jsonResult[basicKeys[i]] = "unchanged";
|
if(_nukiConfig.timeZoneId == tzid) jsonResult[basicKeys[i]] = "unchanged";
|
||||||
else cmdResult = _nukiOpener.setTimeZoneId(tzid);
|
else cmdResult = _nukiOpener.setTimeZoneId(tzid);
|
||||||
@@ -1206,7 +1206,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
else jsonResult[basicKeys[i]] = "invalidValue";
|
else jsonResult[basicKeys[i]] = "invalidValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cmdResult == Nuki::CmdResult::Success) {
|
if(cmdResult != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1433,7 +1433,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
{
|
{
|
||||||
NukiOpener::ButtonPressAction sbpa = nukiOpenerInst->buttonPressActionToEnum(jsonchar);
|
NukiOpener::ButtonPressAction sbpa = nukiOpenerInst->buttonPressActionToEnum(jsonchar);
|
||||||
|
|
||||||
if(!(int)sbpa == 0xff)
|
if((int)sbpa != 0xff)
|
||||||
{
|
{
|
||||||
if(_nukiAdvancedConfig.singleButtonPressAction == sbpa) jsonResult[advancedKeys[j]] = "unchanged";
|
if(_nukiAdvancedConfig.singleButtonPressAction == sbpa) jsonResult[advancedKeys[j]] = "unchanged";
|
||||||
else cmdResult = _nukiOpener.setSingleButtonPressAction(sbpa);
|
else cmdResult = _nukiOpener.setSingleButtonPressAction(sbpa);
|
||||||
@@ -1444,7 +1444,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
{
|
{
|
||||||
NukiOpener::ButtonPressAction dbpa = nukiOpenerInst->buttonPressActionToEnum(jsonchar);
|
NukiOpener::ButtonPressAction dbpa = nukiOpenerInst->buttonPressActionToEnum(jsonchar);
|
||||||
|
|
||||||
if(!(int)dbpa == 0xff)
|
if((int)dbpa != 0xff)
|
||||||
{
|
{
|
||||||
if(_nukiAdvancedConfig.doubleButtonPressAction == dbpa) jsonResult[advancedKeys[j]] = "unchanged";
|
if(_nukiAdvancedConfig.doubleButtonPressAction == dbpa) jsonResult[advancedKeys[j]] = "unchanged";
|
||||||
else cmdResult = _nukiOpener.setDoubleButtonPressAction(dbpa);
|
else cmdResult = _nukiOpener.setDoubleButtonPressAction(dbpa);
|
||||||
@@ -1455,7 +1455,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
{
|
{
|
||||||
Nuki::BatteryType battype = nukiOpenerInst->batteryTypeToEnum(jsonchar);
|
Nuki::BatteryType battype = nukiOpenerInst->batteryTypeToEnum(jsonchar);
|
||||||
|
|
||||||
if(!(int)battype == 0xff)
|
if((int)battype != 0xff)
|
||||||
{
|
{
|
||||||
if(_nukiAdvancedConfig.batteryType == battype) jsonResult[advancedKeys[j]] = "unchanged";
|
if(_nukiAdvancedConfig.batteryType == battype) jsonResult[advancedKeys[j]] = "unchanged";
|
||||||
else cmdResult = _nukiOpener.setBatteryType(battype);
|
else cmdResult = _nukiOpener.setBatteryType(battype);
|
||||||
@@ -1474,7 +1474,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
else jsonResult[advancedKeys[j]] = "invalidValue";
|
else jsonResult[advancedKeys[j]] = "invalidValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cmdResult == Nuki::CmdResult::Success) {
|
if(cmdResult != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1670,7 +1670,7 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1796,7 +1796,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
}
|
}
|
||||||
else if(strcmp(action, "add") == 0 || strcmp(action, "update") == 0)
|
else if(strcmp(action, "add") == 0 || strcmp(action, "update") == 0)
|
||||||
{
|
{
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
if (strcmp(action, "update") != 0)
|
if (strcmp(action, "update") != 0)
|
||||||
{
|
{
|
||||||
@@ -2013,7 +2013,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
if (codeId != entry.codeId) continue;
|
if (codeId != entry.codeId) continue;
|
||||||
else foundExisting = true;
|
else foundExisting = true;
|
||||||
|
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
memset(oldName, 0, sizeof(oldName));
|
memset(oldName, 0, sizeof(oldName));
|
||||||
memcpy(oldName, entry.name, sizeof(entry.name));
|
memcpy(oldName, entry.name, sizeof(entry.name));
|
||||||
@@ -2021,7 +2021,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
if(code == 12) code = entry.code;
|
if(code == 12) code = entry.code;
|
||||||
if(enabled == 2) enabled = entry.enabled;
|
if(enabled == 2) enabled = entry.enabled;
|
||||||
if(timeLimited == 2) timeLimited = entry.timeLimited;
|
if(timeLimited == 2) timeLimited = entry.timeLimited;
|
||||||
if(!allowedFrom.length() > 0)
|
if(allowedFrom.length() < 1)
|
||||||
{
|
{
|
||||||
allowedFrom = "old";
|
allowedFrom = "old";
|
||||||
allowedFromAr[0] = entry.allowedFromYear;
|
allowedFromAr[0] = entry.allowedFromYear;
|
||||||
@@ -2031,7 +2031,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
allowedFromAr[4] = entry.allowedFromMin;
|
allowedFromAr[4] = entry.allowedFromMin;
|
||||||
allowedFromAr[5] = entry.allowedFromSec;
|
allowedFromAr[5] = entry.allowedFromSec;
|
||||||
}
|
}
|
||||||
if(!allowedUntil.length() > 0)
|
if(allowedUntil.length() < 1)
|
||||||
{
|
{
|
||||||
allowedUntil = "old";
|
allowedUntil = "old";
|
||||||
allowedUntilAr[0] = entry.allowedUntilYear;
|
allowedUntilAr[0] = entry.allowedUntilYear;
|
||||||
@@ -2041,15 +2041,15 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
allowedUntilAr[4] = entry.allowedUntilMin;
|
allowedUntilAr[4] = entry.allowedUntilMin;
|
||||||
allowedUntilAr[5] = entry.allowedUntilSec;
|
allowedUntilAr[5] = entry.allowedUntilSec;
|
||||||
}
|
}
|
||||||
if(!allowedWeekdays.length() > 0) allowedWeekdaysInt = entry.allowedWeekdays;
|
if(allowedWeekdays.length() < 1) allowedWeekdaysInt = entry.allowedWeekdays;
|
||||||
if(!allowedFromTime.length() > 0)
|
if(allowedFromTime.length() < 1)
|
||||||
{
|
{
|
||||||
allowedFromTime = "old";
|
allowedFromTime = "old";
|
||||||
allowedFromTimeAr[0] = entry.allowedFromTimeHour;
|
allowedFromTimeAr[0] = entry.allowedFromTimeHour;
|
||||||
allowedFromTimeAr[1] = entry.allowedFromTimeMin;
|
allowedFromTimeAr[1] = entry.allowedFromTimeMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!allowedUntilTime.length() > 0)
|
if(allowedUntilTime.length() < 1)
|
||||||
{
|
{
|
||||||
allowedUntilTime = "old";
|
allowedUntilTime = "old";
|
||||||
allowedUntilTimeAr[0] = entry.allowedUntilTimeHour;
|
allowedUntilTimeAr[0] = entry.allowedUntilTimeHour;
|
||||||
@@ -2075,7 +2075,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
entry.codeId = codeId;
|
entry.codeId = codeId;
|
||||||
entry.code = code;
|
entry.code = code;
|
||||||
|
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
size_t nameLen = strlen(oldName);
|
size_t nameLen = strlen(oldName);
|
||||||
memcpy(&entry.name, oldName, nameLen > 20 ? 20 : nameLen);
|
memcpy(&entry.name, oldName, nameLen > 20 ? 20 : nameLen);
|
||||||
@@ -2141,7 +2141,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -2345,14 +2345,14 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
|||||||
else foundExisting = true;
|
else foundExisting = true;
|
||||||
|
|
||||||
if(enabled == 2) enabled = entry.enabled;
|
if(enabled == 2) enabled = entry.enabled;
|
||||||
if(!weekdays.length() > 0) weekdaysInt = entry.weekdays;
|
if(weekdays.length() < 1) weekdaysInt = entry.weekdays;
|
||||||
if(!time.length() > 0)
|
if(time.length() < 1)
|
||||||
{
|
{
|
||||||
time = "old";
|
time = "old";
|
||||||
timeAr[0] = entry.timeHour;
|
timeAr[0] = entry.timeHour;
|
||||||
timeAr[1] = entry.timeMin;
|
timeAr[1] = entry.timeMin;
|
||||||
}
|
}
|
||||||
if(!lockAction.length() > 0) timeControlLockAction = entry.lockAction;
|
if(lockAction.length() < 1) timeControlLockAction = entry.lockAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundExisting)
|
if(!foundExisting)
|
||||||
@@ -2394,7 +2394,7 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void NukiWrapper::initialize(const bool& firstStart)
|
|||||||
_maxTimeControlEntryCount = _preferences->getUInt(preference_lock_max_timecontrol_entry_count);
|
_maxTimeControlEntryCount = _preferences->getUInt(preference_lock_max_timecontrol_entry_count);
|
||||||
_restartBeaconTimeout = _preferences->getInt(preference_restart_ble_beacon_lost);
|
_restartBeaconTimeout = _preferences->getInt(preference_restart_ble_beacon_lost);
|
||||||
_hassEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
_hassEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";
|
||||||
_nrOfRetries = _preferences->getInt(preference_command_nr_of_retries);
|
_nrOfRetries = _preferences->getInt(preference_command_nr_of_retries, 200);
|
||||||
_retryDelay = _preferences->getInt(preference_command_retry_delay);
|
_retryDelay = _preferences->getInt(preference_command_retry_delay);
|
||||||
_rssiPublishInterval = _preferences->getInt(preference_rssi_publish_interval) * 1000;
|
_rssiPublishInterval = _preferences->getInt(preference_rssi_publish_interval) * 1000;
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ void NukiWrapper::initialize(const bool& firstStart)
|
|||||||
_preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
|
_preferences->putBytes(preference_conf_opener_advanced_acl, (byte*)(&advancedOpenerConfigAclPrefs), sizeof(advancedOpenerConfigAclPrefs));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_nrOfRetries > -1)
|
if(_nrOfRetries == 200)
|
||||||
{
|
{
|
||||||
_nrOfRetries = 3;
|
_nrOfRetries = 3;
|
||||||
_preferences->putInt(preference_command_nr_of_retries, _nrOfRetries);
|
_preferences->putInt(preference_command_nr_of_retries, _nrOfRetries);
|
||||||
@@ -454,7 +454,7 @@ void NukiWrapper::updateBatteryState()
|
|||||||
Log->print(F("Querying lock battery state: "));
|
Log->print(F("Querying lock battery state: "));
|
||||||
result = _nukiLock.requestBatteryReport(&_batteryReport);
|
result = _nukiLock.requestBatteryReport(&_batteryReport);
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -513,7 +513,7 @@ void NukiWrapper::updateConfig()
|
|||||||
_taskRunning = true;
|
_taskRunning = true;
|
||||||
result = _nukiLock.verifySecurityPin();
|
result = _nukiLock.verifySecurityPin();
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -596,7 +596,7 @@ void NukiWrapper::updateAuthData(bool retrieved)
|
|||||||
Log->print(F("Retrieve log entries: "));
|
Log->print(F("Retrieve log entries: "));
|
||||||
result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
result = _nukiLock.retrieveLogEntries(0, _preferences->getInt(preference_authlog_max_entries, MAX_AUTHLOG), 1, false);
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -673,7 +673,7 @@ void NukiWrapper::updateKeypad(bool retrieved)
|
|||||||
Log->print(F("Querying lock keypad: "));
|
Log->print(F("Querying lock keypad: "));
|
||||||
result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
result = _nukiLock.retrieveKeypadEntries(0, _preferences->getInt(preference_keypad_max_entries, MAX_KEYPAD));
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -744,7 +744,7 @@ void NukiWrapper::updateTimeControl(bool retrieved)
|
|||||||
Log->print(F("Querying lock time control: "));
|
Log->print(F("Querying lock time control: "));
|
||||||
result = _nukiLock.retrieveTimeControlEntries();
|
result = _nukiLock.retrieveTimeControlEntries();
|
||||||
_taskRunning = false;
|
_taskRunning = false;
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1359,7 +1359,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
else jsonResult[basicKeys[i]] = "invalidValue";
|
else jsonResult[basicKeys[i]] = "invalidValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cmdResult == Nuki::CmdResult::Success) {
|
if(cmdResult != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1653,7 +1653,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
|||||||
else jsonResult[advancedKeys[j]] = "invalidValue";
|
else jsonResult[advancedKeys[j]] = "invalidValue";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cmdResult == Nuki::CmdResult::Success) {
|
if(cmdResult != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -1888,7 +1888,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -2014,7 +2014,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
}
|
}
|
||||||
else if(strcmp(action, "add") == 0 || strcmp(action, "update") == 0)
|
else if(strcmp(action, "add") == 0 || strcmp(action, "update") == 0)
|
||||||
{
|
{
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
if (strcmp(action, "update") != 0)
|
if (strcmp(action, "update") != 0)
|
||||||
{
|
{
|
||||||
@@ -2231,7 +2231,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
if (codeId != entry.codeId) continue;
|
if (codeId != entry.codeId) continue;
|
||||||
else foundExisting = true;
|
else foundExisting = true;
|
||||||
|
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
memset(oldName, 0, sizeof(oldName));
|
memset(oldName, 0, sizeof(oldName));
|
||||||
memcpy(oldName, entry.name, sizeof(entry.name));
|
memcpy(oldName, entry.name, sizeof(entry.name));
|
||||||
@@ -2239,7 +2239,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
if(code == 12) code = entry.code;
|
if(code == 12) code = entry.code;
|
||||||
if(enabled == 2) enabled = entry.enabled;
|
if(enabled == 2) enabled = entry.enabled;
|
||||||
if(timeLimited == 2) timeLimited = entry.timeLimited;
|
if(timeLimited == 2) timeLimited = entry.timeLimited;
|
||||||
if(!allowedFrom.length() > 0)
|
if(allowedFrom.length() < 1)
|
||||||
{
|
{
|
||||||
allowedFrom = "old";
|
allowedFrom = "old";
|
||||||
allowedFromAr[0] = entry.allowedFromYear;
|
allowedFromAr[0] = entry.allowedFromYear;
|
||||||
@@ -2249,7 +2249,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
allowedFromAr[4] = entry.allowedFromMin;
|
allowedFromAr[4] = entry.allowedFromMin;
|
||||||
allowedFromAr[5] = entry.allowedFromSec;
|
allowedFromAr[5] = entry.allowedFromSec;
|
||||||
}
|
}
|
||||||
if(!allowedUntil.length() > 0)
|
if(allowedUntil.length() < 1)
|
||||||
{
|
{
|
||||||
allowedUntil = "old";
|
allowedUntil = "old";
|
||||||
allowedUntilAr[0] = entry.allowedUntilYear;
|
allowedUntilAr[0] = entry.allowedUntilYear;
|
||||||
@@ -2259,15 +2259,15 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
allowedUntilAr[4] = entry.allowedUntilMin;
|
allowedUntilAr[4] = entry.allowedUntilMin;
|
||||||
allowedUntilAr[5] = entry.allowedUntilSec;
|
allowedUntilAr[5] = entry.allowedUntilSec;
|
||||||
}
|
}
|
||||||
if(!allowedWeekdays.length() > 0) allowedWeekdaysInt = entry.allowedWeekdays;
|
if(allowedWeekdays.length() < 1) allowedWeekdaysInt = entry.allowedWeekdays;
|
||||||
if(!allowedFromTime.length() > 0)
|
if(allowedFromTime.length() < 1)
|
||||||
{
|
{
|
||||||
allowedFromTime = "old";
|
allowedFromTime = "old";
|
||||||
allowedFromTimeAr[0] = entry.allowedFromTimeHour;
|
allowedFromTimeAr[0] = entry.allowedFromTimeHour;
|
||||||
allowedFromTimeAr[1] = entry.allowedFromTimeMin;
|
allowedFromTimeAr[1] = entry.allowedFromTimeMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!allowedUntilTime.length() > 0)
|
if(allowedUntilTime.length() < 1)
|
||||||
{
|
{
|
||||||
allowedUntilTime = "old";
|
allowedUntilTime = "old";
|
||||||
allowedUntilTimeAr[0] = entry.allowedUntilTimeHour;
|
allowedUntilTimeAr[0] = entry.allowedUntilTimeHour;
|
||||||
@@ -2293,7 +2293,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
entry.codeId = codeId;
|
entry.codeId = codeId;
|
||||||
entry.code = code;
|
entry.code = code;
|
||||||
|
|
||||||
if(!name.length() > 0)
|
if(name.length() < 1)
|
||||||
{
|
{
|
||||||
size_t nameLen = strlen(oldName);
|
size_t nameLen = strlen(oldName);
|
||||||
memcpy(&entry.name, oldName, nameLen > 20 ? 20 : nameLen);
|
memcpy(&entry.name, oldName, nameLen > 20 ? 20 : nameLen);
|
||||||
@@ -2359,7 +2359,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
@@ -2563,14 +2563,14 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
|||||||
else foundExisting = true;
|
else foundExisting = true;
|
||||||
|
|
||||||
if(enabled == 2) enabled = entry.enabled;
|
if(enabled == 2) enabled = entry.enabled;
|
||||||
if(!weekdays.length() > 0) weekdaysInt = entry.weekdays;
|
if(weekdays.length() < 1) weekdaysInt = entry.weekdays;
|
||||||
if(!time.length() > 0)
|
if(time.length() < 1)
|
||||||
{
|
{
|
||||||
time = "old";
|
time = "old";
|
||||||
timeAr[0] = entry.timeHour;
|
timeAr[0] = entry.timeHour;
|
||||||
timeAr[1] = entry.timeMin;
|
timeAr[1] = entry.timeMin;
|
||||||
}
|
}
|
||||||
if(!lockAction.length() > 0) timeControlLockAction = entry.lockAction;
|
if(lockAction.length() < 1) timeControlLockAction = entry.lockAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!foundExisting)
|
if(!foundExisting)
|
||||||
@@ -2612,7 +2612,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!result == Nuki::CmdResult::Success) {
|
if(result != Nuki::CmdResult::Success) {
|
||||||
++_retryCount;
|
++_retryCount;
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
|
|||||||
Reference in New Issue
Block a user