diff --git a/src/Config.h b/src/Config.h index b5a4cef..50fcbbf 100644 --- a/src/Config.h +++ b/src/Config.h @@ -5,8 +5,8 @@ #define NUKI_HUB_VERSION "9.15" #define NUKI_HUB_VERSION_INT (uint32_t)915 #define NUKI_HUB_BUILD "unknownbuildnr" -#define NUKI_HUB_DATE "2026-03-20" -#define NUKI_HUB_DATE "2026-03-20" +#define NUKI_HUB_DATE "2026-03-27" +#define NUKI_HUB_DATE "2026-03-27" #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" diff --git a/src/NukiNetworkLock.cpp b/src/NukiNetworkLock.cpp index 4e259d3..6290dad 100644 --- a/src/NukiNetworkLock.cpp +++ b/src/NukiNetworkLock.cpp @@ -14,9 +14,22 @@ extern bool forceEnableWebServer; extern const uint8_t x509_crt_imported_bundle_bin_start[] asm("_binary_x509_crt_bundle_start"); extern const uint8_t x509_crt_imported_bundle_bin_end[] asm("_binary_x509_crt_bundle_end"); -static String normalizedLockMqttName(Preferences* preferences, const char* prefKey) +static const char* defaultLockMqttNameForSlot(uint8_t lockSlot) { - String in = preferences->getString(prefKey, "lock"); + switch(lockSlot) + { + case 2: + return "lock2"; + case 3: + return "lock3"; + default: + return "lock"; + } +} + +static String normalizedLockMqttName(Preferences* preferences, const char* prefKey, const char* fallback) +{ + String in = preferences->getString(prefKey, fallback); in.trim(); in.toLowerCase(); @@ -33,7 +46,7 @@ static String normalizedLockMqttName(Preferences* preferences, const char* prefK if(out.length() < 3 || out.length() > 32) { - return String("lock"); + return String(fallback); } return out; @@ -67,9 +80,10 @@ void NukiNetworkLock::initialize() _saveLogEnabled = true; } + const char* defaultMqttName = defaultLockMqttNameForSlot(_lockSlot); String mqttPath = _preferences->getString(preference_mqtt_lock_path, ""); mqttPath.concat("/"); - mqttPath.concat(normalizedLockMqttName(_preferences, mqttNamePreferenceKey())); + mqttPath.concat(normalizedLockMqttName(_preferences, mqttNamePreferenceKey(), defaultMqttName)); size_t len = mqttPath.length(); for(int i=0; i < len; i++)