Nuki Bluetooth API 2.3.0

This commit is contained in:
iranl
2025-01-12 21:18:58 +01:00
parent c4135967e5
commit 49f6e5db06
5 changed files with 33 additions and 4 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-10"
#define NUKI_HUB_DATE "2025-01-13"
#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

@@ -59,6 +59,11 @@ void NukiWrapper::initialize()
_nukiLock.setDebugHexData(_preferences->getBool(preference_debug_hex_data, false));
_nukiLock.setDebugCommand(_preferences->getBool(preference_debug_command, false));
_nukiLock.registerLogger(Log);
if (_preferences->getInt(preference_lock_gemini_pin, 0) > 0)
{
_nukiLock.saveUltraPincode(_preferences->getInt(preference_lock_gemini_pin, 0), false);
}
_nukiLock.initialize(_preferences->getBool(preference_connect_mode, true));
_nukiLock.registerBleScanner(_bleScanner);

View File

@@ -73,6 +73,7 @@
#define preference_http_auth_type (char*)"httpdAuthType"
#define preference_update_time (char*)"updateTime"
#define preference_mqtt_ssl_enabled (char*)"mqttSSLena"
#define preference_lock_gemini_pin (char*)"geminiPin"
// CHANGE DOES NOT REQUIRE REBOOT TO TAKE EFFECT
#define preference_find_best_rssi (char*)"nwbestrssi"
@@ -473,7 +474,7 @@ private:
preference_opener_continuous_mode, preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count, preference_update_time,
preference_lock_max_timecontrol_entry_count, preference_opener_max_timecontrol_entry_count, preference_enable_bootloop_reset, preference_mqtt_ca, preference_mqtt_crt,
preference_mqtt_key, preference_mqtt_hass_discovery, preference_mqtt_hass_cu_url, preference_buffer_size, preference_ip_dhcp_enabled, preference_ip_address,
preference_ip_subnet, preference_ip_gateway, preference_ip_dns_server, preference_network_hardware, preference_http_auth_type,
preference_ip_subnet, preference_ip_gateway, preference_ip_dns_server, preference_network_hardware, preference_http_auth_type, preference_lock_gemini_pin,
preference_rssi_publish_interval, preference_hostname, preference_network_timeout, preference_restart_on_disconnect, preference_hybrid_reboot_on_disconnect,
preference_restart_ble_beacon_lost, preference_query_interval_lockstate, preference_timecontrol_topic_per_entry, preference_keypad_topic_per_entry,
preference_query_interval_configuration, preference_query_interval_battery, preference_query_interval_keypad, preference_keypad_control_enabled,
@@ -493,7 +494,8 @@ private:
};
std::vector<char*> _redact =
{
preference_mqtt_user, preference_mqtt_password, preference_cred_user, preference_cred_password, preference_nuki_id_lock, preference_nuki_id_opener, preference_wifi_pass
preference_mqtt_user, preference_mqtt_password, preference_cred_user, preference_cred_password, preference_nuki_id_lock, preference_nuki_id_opener, preference_wifi_pass,
preference_lock_gemini_pin
};
std::vector<char*> _boolPrefs =
{

View File

@@ -1482,12 +1482,16 @@ esp_err_t WebCfgServer::sendSettings(PsychicRequest *request, PsychicResponse* r
unsigned char authorizationId[4] = {0x00};
unsigned char secretKeyK[32] = {0x00};
uint16_t storedPincode = 0000;
uint32_t storedUltraPincode = 000000;
bool isUltra = false;
Preferences nukiBlePref;
nukiBlePref.begin("NukiHub", false);
nukiBlePref.getBytes("bleAddress", currentBleAddress, 6);
nukiBlePref.getBytes("secretKeyK", secretKeyK, 32);
nukiBlePref.getBytes("authorizationId", authorizationId, 4);
nukiBlePref.getBytes("securityPinCode", &storedPincode, 2);
nukiBlePref.getBytes("ultraPinCode", &storedUltraPincode, 4);
isUltra = nukiBlePref.getBool("isUltra", false);
nukiBlePref.end();
char text[255];
text[0] = '\0';
@@ -1515,6 +1519,8 @@ esp_err_t WebCfgServer::sendSettings(PsychicRequest *request, PsychicResponse* r
json["authorizationIdLock"] = text;
memset(text, 0, sizeof(text));
json["securityPinCodeLock"] = storedPincode;
json["ultraPinCodeLock"] = storedUltraPincode;
json["isUltra"] = isUltra ? "1" : "0";
}
if(_nukiOpener != nullptr)
{
@@ -1607,6 +1613,8 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
unsigned char authorizationId[4] = {0x00};
unsigned char secretKeyK[32] = {0x00};
unsigned char pincode[2] = {0x00};
unsigned char ultraPincode[4] = {0x00};
bool isUltra = false;
unsigned char currentBleAddressOpn[6];
unsigned char authorizationIdOpn[4] = {0x00};
unsigned char secretKeyKOpn[32] = {0x00};
@@ -2579,6 +2587,16 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
configChanged = true;
}
}
else if(key == "GEMINIPIN")
{
if(_preferences->getInt(preference_lock_gemini_pin, 0) != value.toInt())
{
_preferences->putInt(preference_lock_gemini_pin, value.toInt());
Log->print(F("Setting changed: "));
Log->println(key);
configChanged = true;
}
}
else if(key == "LCKFORCEID")
{
if(_preferences->getBool(preference_lock_force_id, false) != (value == "1"))
@@ -3317,6 +3335,9 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
nukiBlePref.putBytes("secretKeyK", secretKeyK, 32);
nukiBlePref.putBytes("authorizationId", authorizationId, 4);
nukiBlePref.putBytes("securityPinCode", pincode, 2);
nukiBlePref.putBytes("ultraPinCode", ultraPincode, 4);
nukiBlePref.putBool("isUltra", isUltra);
nukiBlePref.end();
Log->print(("Setting changed: "));
Log->println("Lock pairing data");
@@ -4356,6 +4377,7 @@ esp_err_t WebCfgServer::buildAdvancedConfigHtml(PsychicRequest *request, Psychic
printCheckBox(&response, "DBGREAD", "Enable Nuki readable data debug logging", _preferences->getBool(preference_debug_readable_data, false), "");
printCheckBox(&response, "DBGHEX", "Enable Nuki hex data debug logging", _preferences->getBool(preference_debug_hex_data, false), "");
printCheckBox(&response, "DBGCOMM", "Enable Nuki command debug logging", _preferences->getBool(preference_debug_command, false), "");
printInputField(&response, "GEMINIPIN", "SmartLock Ultra PIN", _preferences->getInt(preference_lock_gemini_pin, 0), 6, "");
response.print("</table>");