Keypad improvements

This commit is contained in:
iranl
2025-01-05 20:26:19 +01:00
parent dbb58caf97
commit fdef9984a2
3 changed files with 13 additions and 13 deletions

View File

@@ -336,7 +336,7 @@ void NukiOpenerWrapper::update()
} }
if(_hassEnabled && _nukiConfigValid && _nukiAdvancedConfigValid && !_hassSetupCompleted) if(_hassEnabled && _nukiConfigValid && _nukiAdvancedConfigValid && !_hassSetupCompleted)
{ {
_network->setupHASS(2, _nukiConfig.nukiId, (char*)_nukiConfig.name, _firmwareVersion.c_str(), _hardwareVersion.c_str(), false, _hasKeypad); _network->setupHASS(2, _nukiConfig.nukiId, (char*)_nukiConfig.name, _firmwareVersion.c_str(), _hardwareVersion.c_str(), false, hasKeypad());
_hassSetupCompleted = true; _hassSetupCompleted = true;
} }
if(_rssiPublishInterval > 0 && (_nextRssiTs == 0 || ts > _nextRssiTs)) if(_rssiPublishInterval > 0 && (_nextRssiTs == 0 || ts > _nextRssiTs))
@@ -350,7 +350,7 @@ void NukiOpenerWrapper::update()
_lastRssi = rssi; _lastRssi = rssi;
} }
} }
if(_hasKeypad && _keypadEnabled && (_nextKeypadUpdateTs == 0 || ts > _nextKeypadUpdateTs || (queryCommands & QUERY_COMMAND_KEYPAD) > 0)) if(hasKeypad() && _keypadEnabled && (_nextKeypadUpdateTs == 0 || ts > _nextKeypadUpdateTs || (queryCommands & QUERY_COMMAND_KEYPAD) > 0))
{ {
_nextKeypadUpdateTs = ts + _intervalKeypad * 1000; _nextKeypadUpdateTs = ts + _intervalKeypad * 1000;
updateKeypad(false); updateKeypad(false);
@@ -2469,7 +2469,7 @@ void NukiOpenerWrapper::onKeypadCommandReceived(const char *command, const uint
return; return;
} }
if(!_hasKeypad) if(!hasKeypad())
{ {
if(_nukiConfigValid) if(_nukiConfigValid)
{ {
@@ -2609,7 +2609,7 @@ void NukiOpenerWrapper::onKeypadJsonCommandReceived(const char *value)
return; return;
} }
if(!_hasKeypad) if(!hasKeypad())
{ {
if(_nukiConfigValid) if(_nukiConfigValid)
{ {
@@ -4013,7 +4013,7 @@ const bool NukiOpenerWrapper::isPaired() const
const bool NukiOpenerWrapper::hasKeypad() const const bool NukiOpenerWrapper::hasKeypad() const
{ {
return _forceKeypad || _hasKeypad; return (_forceKeypad || _hasKeypad);
} }
const BLEAddress NukiOpenerWrapper::getBleAddress() const const BLEAddress NukiOpenerWrapper::getBleAddress() const

View File

@@ -351,7 +351,7 @@ void NukiWrapper::update(bool reboot)
} }
if(_hassEnabled && _nukiConfigValid && _nukiAdvancedConfigValid && !_hassSetupCompleted) if(_hassEnabled && _nukiConfigValid && _nukiAdvancedConfigValid && !_hassSetupCompleted)
{ {
_network->setupHASS(1, _nukiConfig.nukiId, (char*)_nukiConfig.name, _firmwareVersion.c_str(), _hardwareVersion.c_str(), hasDoorSensor(), _hasKeypad); _network->setupHASS(1, _nukiConfig.nukiId, (char*)_nukiConfig.name, _firmwareVersion.c_str(), _hardwareVersion.c_str(), hasDoorSensor(), hasKeypad());
_hassSetupCompleted = true; _hassSetupCompleted = true;
} }
if(_rssiPublishInterval > 0 && (_nextRssiTs == 0 || ts > _nextRssiTs)) if(_rssiPublishInterval > 0 && (_nextRssiTs == 0 || ts > _nextRssiTs))
@@ -365,7 +365,7 @@ void NukiWrapper::update(bool reboot)
_lastRssi = rssi; _lastRssi = rssi;
} }
} }
if(_hasKeypad && _keypadEnabled && (_nextKeypadUpdateTs == 0 || ts > _nextKeypadUpdateTs || (queryCommands & QUERY_COMMAND_KEYPAD) > 0)) if(hasKeypad() && _keypadEnabled && (_nextKeypadUpdateTs == 0 || ts > _nextKeypadUpdateTs || (queryCommands & QUERY_COMMAND_KEYPAD) > 0))
{ {
Log->println("Updating Lock keypad based on timer or query"); Log->println("Updating Lock keypad based on timer or query");
_nextKeypadUpdateTs = ts + _intervalKeypad * 1000; _nextKeypadUpdateTs = ts + _intervalKeypad * 1000;
@@ -2502,7 +2502,7 @@ void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, c
return; return;
} }
if(!_hasKeypad) if(!hasKeypad())
{ {
if(_nukiConfigValid) if(_nukiConfigValid)
{ {
@@ -2642,7 +2642,7 @@ void NukiWrapper::onKeypadJsonCommandReceived(const char *value)
return; return;
} }
if(!_hasKeypad) if(!hasKeypad())
{ {
if(_nukiConfigValid) if(_nukiConfigValid)
{ {
@@ -4052,7 +4052,7 @@ const bool NukiWrapper::isPaired() const
const bool NukiWrapper::hasKeypad() const const bool NukiWrapper::hasKeypad() const
{ {
return _forceKeypad || _hasKeypad; return (_forceKeypad || _hasKeypad);
} }
void NukiWrapper::notify(Nuki::EventType eventType) void NukiWrapper::notify(Nuki::EventType eventType)
@@ -4153,10 +4153,10 @@ void NukiWrapper::readAdvancedConfig()
bool NukiWrapper::hasDoorSensor() const bool NukiWrapper::hasDoorSensor() const
{ {
return _forceDoorsensor || return (_forceDoorsensor ||
_keyTurnerState.doorSensorState == Nuki::DoorSensorState::DoorClosed || _keyTurnerState.doorSensorState == Nuki::DoorSensorState::DoorClosed ||
_keyTurnerState.doorSensorState == Nuki::DoorSensorState::DoorOpened || _keyTurnerState.doorSensorState == Nuki::DoorSensorState::DoorOpened ||
_keyTurnerState.doorSensorState == Nuki::DoorSensorState::Calibrating; _keyTurnerState.doorSensorState == Nuki::DoorSensorState::Calibrating);
} }
const BLEAddress NukiWrapper::getBleAddress() const const BLEAddress NukiWrapper::getBleAddress() const