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 "9.08"
#define NUKI_HUB_VERSION_INT (uint32_t)908 #define NUKI_HUB_VERSION_INT (uint32_t)908
#define NUKI_HUB_BUILD "unknownbuildnr" #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_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" #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); 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; 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 }}\" }" }}); 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); 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 // Automatic battery type detection
publishHassTopic("switch", publishHassTopic("switch",

View File

@@ -920,10 +920,14 @@ void NukiNetworkLock::publishAdvancedConfig(const NukiLock::AdvancedConfig &conf
buttonPressActionToString(config.doubleButtonPressAction, str); buttonPressActionToString(config.doubleButtonPressAction, str);
json["doubleButtonPressAction"] = str; json["doubleButtonPressAction"] = str;
json["detachedCylinder"] = config.detachedCylinder; json["detachedCylinder"] = config.detachedCylinder;
memset(str, 0, sizeof(str));
_network->batteryTypeToString(config.batteryType, str); if (!_isUltra)
json["batteryType"] = str; {
json["automaticBatteryTypeDetection"] = config.automaticBatteryTypeDetection; memset(str, 0, sizeof(str));
_network->batteryTypeToString(config.batteryType, str);
json["batteryType"] = str;
json["automaticBatteryTypeDetection"] = config.automaticBatteryTypeDetection;
}
json["unlatchDuration"] = config.unlatchDuration; json["unlatchDuration"] = config.unlatchDuration;
json["autoLockTimeOut"] = config.autoLockTimeOut; json["autoLockTimeOut"] = config.autoLockTimeOut;
json["autoUnLockDisabled"] = config.autoUnLockDisabled; json["autoUnLockDisabled"] = config.autoUnLockDisabled;
@@ -1152,24 +1156,28 @@ void NukiNetworkLock::publishKeypad(const std::list<NukiLock::KeypadEntry>& entr
} }
else else
{ {
for(int i=0; i<maxKeypadCodeCount; i++) if (_clearNonJsonKeypad)
{ {
String codeTopic = _mqttPath; _clearNonJsonKeypad = false;
codeTopic.concat(mqtt_topic_keypad); for(int i=0; i<maxKeypadCodeCount; i++)
codeTopic.concat("/code_"); {
codeTopic.concat(std::to_string(i).c_str()); String codeTopic = _mqttPath;
codeTopic.concat("/"); codeTopic.concat(mqtt_topic_keypad);
_network->removeTopic(codeTopic, "id"); codeTopic.concat("/code_");
_network->removeTopic(codeTopic, "enabled"); codeTopic.concat(std::to_string(i).c_str());
_network->removeTopic(codeTopic, "code"); codeTopic.concat("/");
_network->removeTopic(codeTopic, "name"); _network->removeTopic(codeTopic, "id");
_network->removeTopic(codeTopic, "createdYear"); _network->removeTopic(codeTopic, "enabled");
_network->removeTopic(codeTopic, "createdMonth"); _network->removeTopic(codeTopic, "code");
_network->removeTopic(codeTopic, "createdDay"); _network->removeTopic(codeTopic, "name");
_network->removeTopic(codeTopic, "createdHour"); _network->removeTopic(codeTopic, "createdYear");
_network->removeTopic(codeTopic, "createdMin"); _network->removeTopic(codeTopic, "createdMonth");
_network->removeTopic(codeTopic, "createdSec"); _network->removeTopic(codeTopic, "createdDay");
_network->removeTopic(codeTopic, "lockCount"); _network->removeTopic(codeTopic, "createdHour");
_network->removeTopic(codeTopic, "createdMin");
_network->removeTopic(codeTopic, "createdSec");
_network->removeTopic(codeTopic, "lockCount");
}
} }
for(int j=entries.size(); j<maxKeypadCodeCount; j++) for(int j=entries.size(); j<maxKeypadCodeCount; j++)

View File

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

View File

@@ -1043,24 +1043,28 @@ void NukiNetworkOpener::publishKeypad(const std::list<NukiLock::KeypadEntry>& en
} }
else else
{ {
for(int i=0; i<maxKeypadCodeCount; i++) if (_clearNonJsonKeypad)
{ {
String codeTopic = _mqttPath; _clearNonJsonKeypad = false;
codeTopic.concat(mqtt_topic_keypad); for(int i=0; i<maxKeypadCodeCount; i++)
codeTopic.concat("/code_"); {
codeTopic.concat(std::to_string(i).c_str()); String codeTopic = _mqttPath;
codeTopic.concat("/"); codeTopic.concat(mqtt_topic_keypad);
_network->removeTopic(codeTopic, "id"); codeTopic.concat("/code_");
_network->removeTopic(codeTopic, "enabled"); codeTopic.concat(std::to_string(i).c_str());
_network->removeTopic(codeTopic, "code"); codeTopic.concat("/");
_network->removeTopic(codeTopic, "name"); _network->removeTopic(codeTopic, "id");
_network->removeTopic(codeTopic, "createdYear"); _network->removeTopic(codeTopic, "enabled");
_network->removeTopic(codeTopic, "createdMonth"); _network->removeTopic(codeTopic, "code");
_network->removeTopic(codeTopic, "createdDay"); _network->removeTopic(codeTopic, "name");
_network->removeTopic(codeTopic, "createdHour"); _network->removeTopic(codeTopic, "createdYear");
_network->removeTopic(codeTopic, "createdMin"); _network->removeTopic(codeTopic, "createdMonth");
_network->removeTopic(codeTopic, "createdSec"); _network->removeTopic(codeTopic, "createdDay");
_network->removeTopic(codeTopic, "lockCount"); _network->removeTopic(codeTopic, "createdHour");
_network->removeTopic(codeTopic, "createdMin");
_network->removeTopic(codeTopic, "createdSec");
_network->removeTopic(codeTopic, "lockCount");
}
} }
for(int j=entries.size(); j<maxKeypadCodeCount; j++) for(int j=entries.size(); j<maxKeypadCodeCount; j++)

View File

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

View File

@@ -2096,7 +2096,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
{ {
Nuki::BatteryType battype = nukiInst->batteryTypeToEnum(jsonchar); Nuki::BatteryType battype = nukiInst->batteryTypeToEnum(jsonchar);
if((int)battype != 0xff) if((int)battype != 0xff && !_isUltra)
{ {
if(_nukiAdvancedConfig.batteryType == battype) if(_nukiAdvancedConfig.batteryType == battype)
{ {
@@ -2116,7 +2116,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
{ {
const uint8_t keyvalue = atoi(jsonchar); const uint8_t keyvalue = atoi(jsonchar);
if(keyvalue == 0 || keyvalue == 1) if((keyvalue == 0 || keyvalue == 1) && !_isUltra)
{ {
if(_nukiAdvancedConfig.automaticBatteryTypeDetection == keyvalue) 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("\n\n------------ BLUETOOTH ------------");
response.print("\nBluetooth connection mode: "); 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("\nBluetooth TX power (dB): ");
response.print(_preferences->getInt(preference_ble_tx_power, 9)); response.print(_preferences->getInt(preference_ble_tx_power, 9));
response.print("\nBluetooth command nr of retries: "); response.print("\nBluetooth command nr of retries: ");