Ultra and other improvements

This commit is contained in:
iranl
2025-01-15 16:19:31 +01:00
parent 7cb31f8c22
commit 1c4b5b0e33
9 changed files with 59 additions and 45 deletions

View File

@@ -5,7 +5,7 @@
#define NUKI_HUB_VERSION "9.08"
#define NUKI_HUB_VERSION_INT (uint32_t)908
#define NUKI_HUB_BUILD "unknownbuildnr"
#define NUKI_HUB_DATE "2025-01-14"
#define NUKI_HUB_DATE "2025-01-15"
#define GITHUB_LATEST_RELEASE_URL (char*)"https://github.com/technyon/nuki_hub/releases/latest"
#define GITHUB_OTA_MANIFEST_URL (char*)"https://raw.githubusercontent.com/technyon/nuki_hub/binary/ota/manifest.json"

View File

@@ -1537,7 +1537,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalLockEntities(char *devic
removeHassTopic((char*)"switch", (char*)"detached_cylinder", uidString);
}
if((int)advancedLockConfigAclPrefs[8] == 1)
if((int)advancedLockConfigAclPrefs[8] == 1 && !_preferences->getBool(preference_lock_gemini_enabled, false))
{
JsonDocument json;
json = createHassJson(uidString, "_battery_type", "Battery type", name, baseTopic, String("~") + mqtt_topic_config_advanced_json, deviceType, "", "", "config", String("~") + mqtt_topic_config_action, {{ (char*)"val_tpl", (char*)"{{value_json.batteryType}}" }, { (char*)"en", (char*)"true" }, { (char*)"cmd_tpl", (char*)"{ \"batteryType\": \"{{ value }}\" }" }});
@@ -1553,7 +1553,7 @@ void HomeAssistantDiscovery::publishHASSConfigAdditionalLockEntities(char *devic
removeHassTopic((char*)"select", (char*)"battery_type", uidString);
}
if((int)advancedLockConfigAclPrefs[9] == 1)
if((int)advancedLockConfigAclPrefs[9] == 1 && !_preferences->getBool(preference_lock_gemini_enabled, false))
{
// Automatic battery type detection
publishHassTopic("switch",

View File

@@ -920,10 +920,14 @@ void NukiNetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &conf
buttonPressActionToString(config.doubleButtonPressAction, str);
json["doubleButtonPressAction"] = str;
json["detachedCylinder"] = config.detachedCylinder;
if (!_isUltra)
{
memset(str, 0, sizeof(str));
_network->batteryTypeToString(config.batteryType, str);
json["batteryType"] = str;
json["automaticBatteryTypeDetection"] = config.automaticBatteryTypeDetection;
}
json["unlatchDuration"] = config.unlatchDuration;
json["autoLockTimeOut"] = config.autoLockTimeOut;
json["autoUnLockDisabled"] = config.autoUnLockDisabled;
@@ -1152,6 +1156,9 @@ void NukiNetworkLock::publishKeypad(const std::list<NukiLock::KeypadEntry>& entr
}
else
{
if (_clearNonJsonKeypad)
{
_clearNonJsonKeypad = false;
for(int i=0; i<maxKeypadCodeCount; i++)
{
String codeTopic = _mqttPath;
@@ -1171,6 +1178,7 @@ void NukiNetworkLock::publishKeypad(const std::list<NukiLock::KeypadEntry>& entr
_network->removeTopic(codeTopic, "createdSec");
_network->removeTopic(codeTopic, "lockCount");
}
}
for(int j=entries.size(); j<maxKeypadCodeCount; j++)
{

View File

@@ -89,6 +89,7 @@ private:
bool _firstTunerStatePublish = true;
bool _haEnabled = false;
bool _disableNonJSON = false;
bool _clearNonJsonKeypad = true;
bool _offConnected = false;
bool _hybridRebootOnDisconnect = false;
bool _isUltra = false;

View File

@@ -1043,6 +1043,9 @@ void NukiNetworkOpener::publishKeypad(const std::list<NukiLock::KeypadEntry>& en
}
else
{
if (_clearNonJsonKeypad)
{
_clearNonJsonKeypad = false;
for(int i=0; i<maxKeypadCodeCount; i++)
{
String codeTopic = _mqttPath;
@@ -1062,6 +1065,7 @@ void NukiNetworkOpener::publishKeypad(const std::list<NukiLock::KeypadEntry>& en
_network->removeTopic(codeTopic, "createdSec");
_network->removeTopic(codeTopic, "lockCount");
}
}
for(int j=entries.size(); j<maxKeypadCodeCount; j++)
{

View File

@@ -79,6 +79,7 @@ private:
bool _firstTunerStatePublish = true;
bool _haEnabled = false;
bool _disableNonJSON = false;
bool _clearNonJsonKeypad = true;
String _keypadCommandName = "";
String _keypadCommandCode = "";

View File

@@ -2096,7 +2096,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
{
Nuki::BatteryType battype = nukiInst->batteryTypeToEnum(jsonchar);
if((int)battype != 0xff)
if((int)battype != 0xff && !_isUltra)
{
if(_nukiAdvancedConfig.batteryType == battype)
{
@@ -2116,7 +2116,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
{
const uint8_t keyvalue = atoi(jsonchar);
if(keyvalue == 0 || keyvalue == 1)
if((keyvalue == 0 || keyvalue == 1) && !_isUltra)
{
if(_nukiAdvancedConfig.automaticBatteryTypeDetection == keyvalue)
{

View File

@@ -5112,7 +5112,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
}
response.print("\n\n------------ BLUETOOTH ------------");
response.print("\nBluetooth connection mode: ");
response.print(_preferences->getBool(preference_connect_mode, false) ? "New" : "Old");
response.print(_preferences->getBool(preference_connect_mode, true) ? "New" : "Old");
response.print("\nBluetooth TX power (dB): ");
response.print(_preferences->getInt(preference_ble_tx_power, 9));
response.print("\nBluetooth command nr of retries: ");