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