Squashed commit of the following:
commitea34708fd1Merge:e14877b1dcef13Author: Jan-Ole Schümann <j.o.schuemann@gmx.de> Date: Tue Mar 26 20:16:00 2024 +0700 Merge pull request #328 from iranl/ha-fixes Multiple fixes (Nuki ID + README + ACL + DoorSensor/Keypad) commit1dcef135fcAuthor: iranl <iranl@users.noreply.github.com> Date: Sun Mar 24 22:28:44 2024 +0100 Add extra checks and auto retries commit56d718bc00Author: iranl <iranl@users.noreply.github.com> Date: Sat Mar 23 19:52:50 2024 +0100 Remove Force options commita3658bfd3cAuthor: iranl <iranl@users.noreply.github.com> Date: Sun Mar 17 22:57:24 2024 +0100 Update README.md commitef7fe751edAuthor: iranl <iranl@users.noreply.github.com> Date: Sun Mar 17 22:50:46 2024 +0100 Update WebCfgServer.cpp commitac375df39fAuthor: iranl <iranl@users.noreply.github.com> Date: Sun Mar 17 22:47:42 2024 +0100 Redact Nuki ID commit516af39fe6Author: iranl <iranl@users.noreply.github.com> Date: Sun Mar 17 22:40:22 2024 +0100 ACL Info WebCfg + Force Keypad/DoorSensor commit3db4c0699eAuthor: iranl <iranl@users.noreply.github.com> Date: Sun Mar 17 21:59:57 2024 +0100 Nuki ID + README + ACL fix
This commit is contained in:
@@ -303,6 +303,7 @@ void NukiWrapper::unpair()
|
||||
{
|
||||
_nukiLock.unPairNuki();
|
||||
_deviceId->assignNewId();
|
||||
_preferences->remove(preference_nuki_id_lock);
|
||||
_paired = false;
|
||||
}
|
||||
|
||||
@@ -361,16 +362,48 @@ void NukiWrapper::updateConfig()
|
||||
readConfig();
|
||||
readAdvancedConfig();
|
||||
_configRead = true;
|
||||
_hasKeypad = _nukiConfig.hasKeypad > 0 || _nukiConfig.hasKeypadV2;
|
||||
bool expectedConfig = true;
|
||||
|
||||
if(_nukiConfigValid)
|
||||
{
|
||||
_firmwareVersion = std::to_string(_nukiConfig.firmwareVersion[0]) + "." + std::to_string(_nukiConfig.firmwareVersion[1]) + "." + std::to_string(_nukiConfig.firmwareVersion[2]);
|
||||
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
|
||||
_network->publishConfig(_nukiConfig);
|
||||
if(_preferences->getUInt(preference_nuki_id_lock, 0) == 0 || _retryConfigCount == 10)
|
||||
{
|
||||
_preferences->putUInt(preference_nuki_id_lock, _nukiConfig.nukiId);
|
||||
}
|
||||
|
||||
if(_preferences->getUInt(preference_nuki_id_lock, 0) == _nukiConfig.nukiId)
|
||||
{
|
||||
_hasKeypad = _nukiConfig.hasKeypad > 0 || _nukiConfig.hasKeypadV2;
|
||||
_firmwareVersion = std::to_string(_nukiConfig.firmwareVersion[0]) + "." + std::to_string(_nukiConfig.firmwareVersion[1]) + "." + std::to_string(_nukiConfig.firmwareVersion[2]);
|
||||
_hardwareVersion = std::to_string(_nukiConfig.hardwareRevision[0]) + "." + std::to_string(_nukiConfig.hardwareRevision[1]);
|
||||
_network->publishConfig(_nukiConfig);
|
||||
_retryConfigCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedConfig = false;
|
||||
++_retryConfigCount;
|
||||
}
|
||||
}
|
||||
if(_nukiAdvancedConfigValid)
|
||||
else
|
||||
{
|
||||
expectedConfig = false;
|
||||
++_retryConfigCount;
|
||||
}
|
||||
if(_nukiAdvancedConfigValid && _preferences->getUInt(preference_nuki_id_lock, 0) == _nukiConfig.nukiId)
|
||||
{
|
||||
_network->publishAdvancedConfig(_nukiAdvancedConfig);
|
||||
_retryConfigCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
expectedConfig = false;
|
||||
++_retryConfigCount;
|
||||
}
|
||||
if(!expectedConfig && _retryConfigCount < 11)
|
||||
{
|
||||
unsigned long ts = millis();
|
||||
_nextConfigUpdateTs = ts + 60000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -560,13 +593,6 @@ void NukiWrapper::onConfigUpdateReceived(const char *topic, const char *value)
|
||||
_nukiLock.enableAutoLock(newValue);
|
||||
_nextConfigUpdateTs = millis() + 300;
|
||||
}
|
||||
else if(strcmp(topic, mqtt_topic_config_auto_lock) == 0)
|
||||
{
|
||||
bool newValue = atoi(value) > 0;
|
||||
if(!_nukiAdvancedConfigValid || _nukiAdvancedConfig.autoLockEnabled == newValue) return;
|
||||
_nukiLock.enableAutoLock(newValue);
|
||||
_nextConfigUpdateTs = millis() + 300;
|
||||
}
|
||||
}
|
||||
|
||||
void NukiWrapper::onKeypadCommandReceived(const char *command, const uint &id, const String &name, const String &code, const int& enabled)
|
||||
@@ -732,6 +758,7 @@ void NukiWrapper::readAdvancedConfig()
|
||||
void NukiWrapper::setupHASS()
|
||||
{
|
||||
if(!_nukiConfigValid) return;
|
||||
if(_preferences->getUInt(preference_nuki_id_lock, 0) != _nukiConfig.nukiId) return;
|
||||
|
||||
String baseTopic = _preferences->getString(preference_mqtt_lock_path);
|
||||
char uidString[20];
|
||||
|
||||
Reference in New Issue
Block a user