BLE improvements
This commit is contained in:
@@ -291,7 +291,6 @@ In a browser navigate to the IP address assigned to the ESP32.
|
|||||||
- Nuki Smartlock enabled: Enable if you want Nuki Hub to connect to a Nuki Lock (1.0-4.0 and Ultra)
|
- Nuki Smartlock enabled: Enable if you want Nuki Hub to connect to a Nuki Lock (1.0-4.0 and Ultra)
|
||||||
- Nuki Smartlock Ultra/Go/5th gen enabled: Enable if you want Nuki Hub to connect to a Nuki Lock Ultra/Go/5th gen Pro
|
- Nuki Smartlock Ultra/Go/5th gen enabled: Enable if you want Nuki Hub to connect to a Nuki Lock Ultra/Go/5th gen Pro
|
||||||
- Nuki Opener enabled: Enable if you want Nuki Hub to connect to a Nuki Opener
|
- Nuki Opener enabled: Enable if you want Nuki Hub to connect to a Nuki Opener
|
||||||
- New Nuki Bluetooth connection mode (disable if there are connection issues): Enable to use the latest Nuki BLE connection mode (recommended). Disable if you have issues communicating with the lock/opener
|
|
||||||
|
|
||||||
#### Advanced Nuki Configuration
|
#### Advanced Nuki Configuration
|
||||||
|
|
||||||
|
|||||||
Submodule lib/nuki_ble updated: 01c81b52b2...c54698d31d
@@ -5,7 +5,7 @@
|
|||||||
#define NUKI_HUB_VERSION "9.12"
|
#define NUKI_HUB_VERSION "9.12"
|
||||||
#define NUKI_HUB_VERSION_INT (uint32_t)912
|
#define NUKI_HUB_VERSION_INT (uint32_t)912
|
||||||
#define NUKI_HUB_BUILD "unknownbuildnr"
|
#define NUKI_HUB_BUILD "unknownbuildnr"
|
||||||
#define NUKI_HUB_DATE "2025-06-19"
|
#define NUKI_HUB_DATE "2025-06-20"
|
||||||
|
|
||||||
#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"
|
||||||
|
|||||||
@@ -103,19 +103,9 @@ void NukiNetwork::setupDevice()
|
|||||||
Log->print("Network device: ");
|
Log->print("Network device: ");
|
||||||
Log->println(_device->deviceName());
|
Log->println(_device->deviceName());
|
||||||
|
|
||||||
#ifndef NUKI_HUB_UPDATER
|
#ifndef NUKI_HUB_UPDATER
|
||||||
_device->mqttOnConnect([&](bool sessionPresent)
|
|
||||||
{
|
|
||||||
onMqttConnect(sessionPresent);
|
|
||||||
});
|
|
||||||
_device->mqttOnDisconnect([&](espMqttClientTypes::DisconnectReason reason)
|
|
||||||
{
|
|
||||||
onMqttDisconnect(reason);
|
|
||||||
});
|
|
||||||
|
|
||||||
_hadiscovery = new HomeAssistantDiscovery(_device, _preferences, _buffer, _bufferSize);
|
_hadiscovery = new HomeAssistantDiscovery(_device, _preferences, _buffer, _bufferSize);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NukiNetwork::reconfigureDevice()
|
void NukiNetwork::reconfigureDevice()
|
||||||
@@ -391,6 +381,17 @@ void NukiNetwork::setMQTTConnectionSettings()
|
|||||||
Log->print(_mqttBrokerAddr);
|
Log->print(_mqttBrokerAddr);
|
||||||
Log->print(":");
|
Log->print(":");
|
||||||
Log->println(_mqttPort);
|
Log->println(_mqttPort);
|
||||||
|
|
||||||
|
#ifndef NUKI_HUB_UPDATER
|
||||||
|
_device->mqttOnConnect([&](bool sessionPresent)
|
||||||
|
{
|
||||||
|
onMqttConnect(sessionPresent);
|
||||||
|
});
|
||||||
|
_device->mqttOnDisconnect([&](espMqttClientTypes::DisconnectReason reason)
|
||||||
|
{
|
||||||
|
onMqttDisconnect(reason);
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int NukiNetwork::getRestartServices()
|
int NukiNetwork::getRestartServices()
|
||||||
@@ -703,7 +704,8 @@ bool NukiNetwork::reconnect(bool force)
|
|||||||
{
|
{
|
||||||
if (force)
|
if (force)
|
||||||
{
|
{
|
||||||
_device->mqttDisconnect(true);
|
_mqttReceivers.clear();
|
||||||
|
_device->mqttRestart();
|
||||||
setMQTTConnectionSettings();
|
setMQTTConnectionSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,10 +62,10 @@ void NukiOpenerWrapper::initialize()
|
|||||||
_nukiOpener.setDebugCommand(_preferences->getBool(preference_debug_command, false));
|
_nukiOpener.setDebugCommand(_preferences->getBool(preference_debug_command, false));
|
||||||
_nukiOpener.registerLogger(Log);
|
_nukiOpener.registerLogger(Log);
|
||||||
|
|
||||||
_nukiOpener.initialize(_preferences->getBool(preference_connect_mode, true));
|
_nukiOpener.initialize();
|
||||||
_nukiOpener.registerBleScanner(_bleScanner);
|
_nukiOpener.registerBleScanner(_bleScanner);
|
||||||
_nukiOpener.setEventHandler(this);
|
_nukiOpener.setEventHandler(this);
|
||||||
_nukiOpener.setConnectTimeout(3);
|
_nukiOpener.setConnectTimeout(2);
|
||||||
_nukiOpener.setDisconnectTimeout(2000);
|
_nukiOpener.setDisconnectTimeout(2000);
|
||||||
|
|
||||||
_hassEnabled = _preferences->getBool(preference_mqtt_hass_enabled, false);
|
_hassEnabled = _preferences->getBool(preference_mqtt_hass_enabled, false);
|
||||||
@@ -337,9 +337,17 @@ void NukiOpenerWrapper::update()
|
|||||||
}
|
}
|
||||||
if(_statusUpdated || _nextLockStateUpdateTs == 0 || ts >= _nextLockStateUpdateTs || (queryCommands & QUERY_COMMAND_LOCKSTATE) > 0)
|
if(_statusUpdated || _nextLockStateUpdateTs == 0 || ts >= _nextLockStateUpdateTs || (queryCommands & QUERY_COMMAND_LOCKSTATE) > 0)
|
||||||
{
|
{
|
||||||
_statusUpdated = updateKeyTurnerState();
|
|
||||||
_nextLockStateUpdateTs = ts + _intervalLockstate * 1000;
|
_nextLockStateUpdateTs = ts + _intervalLockstate * 1000;
|
||||||
|
_statusUpdated = updateKeyTurnerState();
|
||||||
_network->publishStatusUpdated(_statusUpdated);
|
_network->publishStatusUpdated(_statusUpdated);
|
||||||
|
|
||||||
|
if(_statusUpdated)
|
||||||
|
{
|
||||||
|
if (esp_task_wdt_status(NULL) == ESP_OK) {
|
||||||
|
esp_task_wdt_reset();
|
||||||
|
}
|
||||||
|
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(_network->mqttConnectionState() == 2)
|
if(_network->mqttConnectionState() == 2)
|
||||||
{
|
{
|
||||||
@@ -517,6 +525,10 @@ bool NukiOpenerWrapper::updateKeyTurnerState()
|
|||||||
Log->println("ms");
|
Log->println("ms");
|
||||||
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_nextLockStateUpdateTs = espMillis() + (_retryLockstateCount * 333);
|
||||||
|
}
|
||||||
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ void NukiWrapper::initialize()
|
|||||||
_nukiLock.saveUltraPincode(_preferences->getInt(preference_lock_gemini_pin, 0), false);
|
_nukiLock.saveUltraPincode(_preferences->getInt(preference_lock_gemini_pin, 0), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_nukiLock.initialize(_preferences->getBool(preference_connect_mode, true));
|
_nukiLock.initialize();
|
||||||
_nukiLock.registerBleScanner(_bleScanner);
|
_nukiLock.registerBleScanner(_bleScanner);
|
||||||
_nukiLock.setEventHandler(this);
|
_nukiLock.setEventHandler(this);
|
||||||
_nukiLock.setConnectTimeout(3);
|
_nukiLock.setConnectTimeout(2);
|
||||||
_nukiLock.setDisconnectTimeout(2000);
|
_nukiLock.setDisconnectTimeout(2000);
|
||||||
|
|
||||||
_hassEnabled = _preferences->getBool(preference_mqtt_hass_enabled, false);
|
_hassEnabled = _preferences->getBool(preference_mqtt_hass_enabled, false);
|
||||||
@@ -361,9 +361,17 @@ void NukiWrapper::update(bool reboot)
|
|||||||
if(_nukiOfficial->getStatusUpdated() || _statusUpdated || _nextLockStateUpdateTs == 0 || ts >= _nextLockStateUpdateTs || (queryCommands & QUERY_COMMAND_LOCKSTATE) > 0)
|
if(_nukiOfficial->getStatusUpdated() || _statusUpdated || _nextLockStateUpdateTs == 0 || ts >= _nextLockStateUpdateTs || (queryCommands & QUERY_COMMAND_LOCKSTATE) > 0)
|
||||||
{
|
{
|
||||||
Log->println("Updating Lock state based on status, timer or query");
|
Log->println("Updating Lock state based on status, timer or query");
|
||||||
_statusUpdated = updateKeyTurnerState();
|
|
||||||
_nextLockStateUpdateTs = ts + _intervalLockstate * 1000;
|
_nextLockStateUpdateTs = ts + _intervalLockstate * 1000;
|
||||||
|
_statusUpdated = updateKeyTurnerState();
|
||||||
_network->publishStatusUpdated(_statusUpdated);
|
_network->publishStatusUpdated(_statusUpdated);
|
||||||
|
|
||||||
|
if(_statusUpdated)
|
||||||
|
{
|
||||||
|
if (esp_task_wdt_status(NULL) == ESP_OK) {
|
||||||
|
esp_task_wdt_reset();
|
||||||
|
}
|
||||||
|
vTaskDelay(500 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(_network->mqttConnectionState() == 2)
|
if(_network->mqttConnectionState() == 2)
|
||||||
{
|
{
|
||||||
@@ -382,7 +390,7 @@ void NukiWrapper::update(bool reboot)
|
|||||||
updateConfig();
|
updateConfig();
|
||||||
if(_isDebugging)
|
if(_isDebugging)
|
||||||
{
|
{
|
||||||
updateDebug();
|
//updateDebug();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_waitAuthLogUpdateTs != 0 && ts > _waitAuthLogUpdateTs)
|
if(_waitAuthLogUpdateTs != 0 && ts > _waitAuthLogUpdateTs)
|
||||||
@@ -551,6 +559,10 @@ bool NukiWrapper::updateKeyTurnerState()
|
|||||||
Log->println("ms");
|
Log->println("ms");
|
||||||
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_nextLockStateUpdateTs = espMillis() + (_retryLockstateCount * 333);
|
||||||
|
}
|
||||||
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
_network->publishKeyTurnerState(_keyTurnerState, _lastKeyTurnerState);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,10 +37,6 @@
|
|||||||
#define preference_time_server (char*)"timeServer"
|
#define preference_time_server (char*)"timeServer"
|
||||||
|
|
||||||
//MQTT RELATED
|
//MQTT RELATED
|
||||||
#define preference_mqtt_ssl_enabled (char*)"mqttSSLena"
|
|
||||||
#define preference_mqtt_ca (char*)"mqttca"
|
|
||||||
#define preference_mqtt_crt (char*)"mqttcrt"
|
|
||||||
#define preference_mqtt_key (char*)"mqttkey"
|
|
||||||
#define preference_mqtt_log_enabled (char*)"mqttlog"
|
#define preference_mqtt_log_enabled (char*)"mqttlog"
|
||||||
#define preference_gpio_configuration (char*)"gpiocfg"
|
#define preference_gpio_configuration (char*)"gpiocfg"
|
||||||
|
|
||||||
@@ -105,7 +101,6 @@
|
|||||||
#define preference_opener_force_keypad (char*)"opForceKp"
|
#define preference_opener_force_keypad (char*)"opForceKp"
|
||||||
#define preference_admin_secret (char*)"adminsecret"
|
#define preference_admin_secret (char*)"adminsecret"
|
||||||
|
|
||||||
//TO BE EFFECTUATED IN WEBSERVER AND OTHER USES
|
|
||||||
//REQUIRE SERVICES RELOAD
|
//REQUIRE SERVICES RELOAD
|
||||||
#define preference_lock_enabled (char*)"lockena"
|
#define preference_lock_enabled (char*)"lockena"
|
||||||
#define preference_opener_enabled (char*)"openerena"
|
#define preference_opener_enabled (char*)"openerena"
|
||||||
@@ -119,7 +114,6 @@
|
|||||||
#define preference_cred_password (char*)"crdpass"
|
#define preference_cred_password (char*)"crdpass"
|
||||||
#define preference_lock_gemini_pin (char*)"geminiPin"
|
#define preference_lock_gemini_pin (char*)"geminiPin"
|
||||||
#define preference_lock_gemini_enabled (char*)"geminiena"
|
#define preference_lock_gemini_enabled (char*)"geminiena"
|
||||||
#define preference_connect_mode (char*)"nukiConnMode"
|
|
||||||
#define preference_https_fqdn (char*)"httpsFQDN"
|
#define preference_https_fqdn (char*)"httpsFQDN"
|
||||||
#define preference_bypass_proxy (char*)"credBypass"
|
#define preference_bypass_proxy (char*)"credBypass"
|
||||||
#define preference_http_auth_type (char*)"httpdAuthType"
|
#define preference_http_auth_type (char*)"httpdAuthType"
|
||||||
@@ -160,8 +154,10 @@
|
|||||||
#define preference_hybrid_reboot_on_disconnect (char*)"hybridRbtLck"
|
#define preference_hybrid_reboot_on_disconnect (char*)"hybridRbtLck"
|
||||||
#define preference_bypass_secret (char*)"bypassecret"
|
#define preference_bypass_secret (char*)"bypassecret"
|
||||||
#define preference_totp_secret (char*)"totpsecret"
|
#define preference_totp_secret (char*)"totpsecret"
|
||||||
|
#define preference_mqtt_ssl_enabled (char*)"mqttSSLena"
|
||||||
//END TO BE EFFECTUATED IN WEBSERVER AND OTHER USES
|
#define preference_mqtt_ca (char*)"mqttca"
|
||||||
|
#define preference_mqtt_crt (char*)"mqttcrt"
|
||||||
|
#define preference_mqtt_key (char*)"mqttkey"
|
||||||
|
|
||||||
//NOT USER CHANGABLE
|
//NOT USER CHANGABLE
|
||||||
#define preference_mfa_reconfigure (char*)"mfaRECONF"
|
#define preference_mfa_reconfigure (char*)"mfaRECONF"
|
||||||
@@ -254,7 +250,6 @@ inline void initPreferences(Preferences* preferences)
|
|||||||
preferences->putBool(preference_debug_readable_data, false);
|
preferences->putBool(preference_debug_readable_data, false);
|
||||||
preferences->putBool(preference_debug_hex_data, false);
|
preferences->putBool(preference_debug_hex_data, false);
|
||||||
preferences->putBool(preference_debug_command, false);
|
preferences->putBool(preference_debug_command, false);
|
||||||
preferences->putBool(preference_connect_mode, true);
|
|
||||||
preferences->putBool(preference_retain_gpio, false);
|
preferences->putBool(preference_retain_gpio, false);
|
||||||
preferences->putBool(preference_enable_debug_mode, false);
|
preferences->putBool(preference_enable_debug_mode, false);
|
||||||
preferences->putBool(preference_cred_duo_enabled, false);
|
preferences->putBool(preference_cred_duo_enabled, false);
|
||||||
@@ -544,7 +539,7 @@ private:
|
|||||||
preference_network_custom_pwr, preference_network_custom_mdio, preference_lock_max_auth_entry_count, preference_opener_max_auth_entry_count,
|
preference_network_custom_pwr, preference_network_custom_mdio, preference_lock_max_auth_entry_count, preference_opener_max_auth_entry_count,
|
||||||
preference_auth_control_enabled, preference_auth_topic_per_entry, preference_auth_info_enabled, preference_auth_max_entries, preference_wifi_ssid, preference_wifi_pass,
|
preference_auth_control_enabled, preference_auth_topic_per_entry, preference_auth_info_enabled, preference_auth_max_entries, preference_wifi_ssid, preference_wifi_pass,
|
||||||
preference_keypad_check_code_enabled, preference_disable_network_not_connected, preference_mqtt_hass_enabled, preference_hass_device_discovery, preference_retain_gpio,
|
preference_keypad_check_code_enabled, preference_disable_network_not_connected, preference_mqtt_hass_enabled, preference_hass_device_discovery, preference_retain_gpio,
|
||||||
preference_debug_connect, preference_debug_communication, preference_debug_readable_data, preference_debug_hex_data, preference_debug_command, preference_connect_mode,
|
preference_debug_connect, preference_debug_communication, preference_debug_readable_data, preference_debug_hex_data, preference_debug_command,
|
||||||
preference_lock_force_id, preference_lock_force_doorsensor, preference_lock_force_keypad, preference_opener_force_id, preference_opener_force_keypad, preference_nukihub_id,
|
preference_lock_force_id, preference_lock_force_doorsensor, preference_lock_force_keypad, preference_opener_force_id, preference_opener_force_keypad, preference_nukihub_id,
|
||||||
preference_cred_duo_host, preference_cred_duo_ikey, preference_cred_duo_skey, preference_cred_duo_user, preference_cred_duo_enabled, preference_https_fqdn, preference_bypass_proxy,
|
preference_cred_duo_host, preference_cred_duo_ikey, preference_cred_duo_skey, preference_cred_duo_user, preference_cred_duo_enabled, preference_https_fqdn, preference_bypass_proxy,
|
||||||
preference_cred_session_lifetime, preference_cred_session_lifetime_remember, preference_cred_session_lifetime_duo, preference_cred_session_lifetime_duo_remember,
|
preference_cred_session_lifetime, preference_cred_session_lifetime_remember, preference_cred_session_lifetime_duo, preference_cred_session_lifetime_duo_remember,
|
||||||
@@ -568,7 +563,7 @@ private:
|
|||||||
preference_official_hybrid_actions, preference_official_hybrid_retry, preference_conf_info_enabled, preference_disable_non_json, preference_update_from_mqtt,
|
preference_official_hybrid_actions, preference_official_hybrid_retry, preference_conf_info_enabled, preference_disable_non_json, preference_update_from_mqtt,
|
||||||
preference_auth_control_enabled, preference_auth_topic_per_entry, preference_auth_info_enabled, preference_webserial_enabled, preference_hass_device_discovery,
|
preference_auth_control_enabled, preference_auth_topic_per_entry, preference_auth_info_enabled, preference_webserial_enabled, preference_hass_device_discovery,
|
||||||
preference_keypad_check_code_enabled, preference_disable_network_not_connected, preference_find_best_rssi, preference_cred_bypass_boot_btn_enabled,
|
preference_keypad_check_code_enabled, preference_disable_network_not_connected, preference_find_best_rssi, preference_cred_bypass_boot_btn_enabled,
|
||||||
preference_debug_connect, preference_debug_communication, preference_debug_readable_data, preference_debug_hex_data, preference_debug_command, preference_connect_mode,
|
preference_debug_connect, preference_debug_communication, preference_debug_readable_data, preference_debug_hex_data, preference_debug_command,
|
||||||
preference_lock_force_id, preference_lock_force_doorsensor, preference_lock_force_keypad, preference_opener_force_id, preference_opener_force_keypad, preference_mqtt_ssl_enabled,
|
preference_lock_force_id, preference_lock_force_doorsensor, preference_lock_force_keypad, preference_opener_force_id, preference_opener_force_keypad, preference_mqtt_ssl_enabled,
|
||||||
preference_hybrid_reboot_on_disconnect, preference_lock_gemini_enabled, preference_enable_debug_mode, preference_cred_duo_enabled, preference_cred_duo_approval,
|
preference_hybrid_reboot_on_disconnect, preference_lock_gemini_enabled, preference_enable_debug_mode, preference_cred_duo_enabled, preference_cred_duo_approval,
|
||||||
preference_publish_config, preference_config_from_mqtt
|
preference_publish_config, preference_config_from_mqtt
|
||||||
|
|||||||
@@ -694,7 +694,7 @@ void WebCfgServer::initialize()
|
|||||||
return resp->redirect("/");
|
return resp->redirect("/");
|
||||||
}
|
}
|
||||||
esp_err_t res = buildConfirmHtml(request, resp, "Restarting services...", 2, true);
|
esp_err_t res = buildConfirmHtml(request, resp, "Restarting services...", 2, true);
|
||||||
_network->setRestartServices(_restartServicesRequired);
|
_network->setRestartServices(_restartServicesRequired == 1 ? false : true);
|
||||||
_restartServicesRequired = 0;
|
_restartServicesRequired = 0;
|
||||||
waitAndProcess(true, 1000);
|
waitAndProcess(true, 1000);
|
||||||
return res;
|
return res;
|
||||||
@@ -2626,7 +2626,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
|
|||||||
}
|
}
|
||||||
Log->print("Setting changed: ");
|
Log->print("Setting changed: ");
|
||||||
Log->println(key);
|
Log->println(key);
|
||||||
configChanged = true;
|
restartServicesReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2662,7 +2662,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
|
|||||||
}
|
}
|
||||||
Log->print("Setting changed: ");
|
Log->print("Setting changed: ");
|
||||||
Log->println(key);
|
Log->println(key);
|
||||||
configChanged = true;
|
restartServicesReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2698,7 +2698,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
|
|||||||
}
|
}
|
||||||
Log->print("Setting changed: ");
|
Log->print("Setting changed: ");
|
||||||
Log->println(key);
|
Log->println(key);
|
||||||
configChanged = true;
|
restartServicesReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3258,7 +3258,7 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
|
|||||||
_preferences->putBool(preference_mqtt_ssl_enabled, (value == "1"));
|
_preferences->putBool(preference_mqtt_ssl_enabled, (value == "1"));
|
||||||
Log->print("Setting changed: ");
|
Log->print("Setting changed: ");
|
||||||
Log->println(key);
|
Log->println(key);
|
||||||
configChanged = true;
|
restartServicesReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(key == "WEBLOG")
|
else if(key == "WEBLOG")
|
||||||
@@ -4329,16 +4329,6 @@ bool WebCfgServer::processArgs(PsychicRequest *request, PsychicResponse* resp, S
|
|||||||
restartServicesReconnect = true;
|
restartServicesReconnect = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(key == "CONNMODE")
|
|
||||||
{
|
|
||||||
if(_preferences->getBool(preference_connect_mode, true) != (value == "1"))
|
|
||||||
{
|
|
||||||
_preferences->putBool(preference_connect_mode, (value == "1"));
|
|
||||||
Log->print("Setting changed: ");
|
|
||||||
Log->println(key);
|
|
||||||
restartServicesNoReconnect = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(key == "CREDUSER")
|
else if(key == "CREDUSER")
|
||||||
{
|
{
|
||||||
if(value == "#")
|
if(value == "#")
|
||||||
@@ -5791,7 +5781,6 @@ esp_err_t WebCfgServer::buildNukiConfigHtml(PsychicRequest *request, PsychicResp
|
|||||||
printCheckBox(&response, "LOCKENA", "Nuki Lock enabled", _preferences->getBool(preference_lock_enabled, true), "");
|
printCheckBox(&response, "LOCKENA", "Nuki Lock enabled", _preferences->getBool(preference_lock_enabled, true), "");
|
||||||
printCheckBox(&response, "GEMINIENA", "Nuki Smartlock Ultra/Go/5th gen enabled", _preferences->getBool(preference_lock_gemini_enabled, false), "");
|
printCheckBox(&response, "GEMINIENA", "Nuki Smartlock Ultra/Go/5th gen enabled", _preferences->getBool(preference_lock_gemini_enabled, false), "");
|
||||||
printCheckBox(&response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled, false), "");
|
printCheckBox(&response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled, false), "");
|
||||||
printCheckBox(&response, "CONNMODE", "New Nuki Bluetooth connection mode (disable if there are connection issues)", _preferences->getBool(preference_connect_mode, true), "");
|
|
||||||
response.print("</table><br>");
|
response.print("</table><br>");
|
||||||
response.print("<h3>Advanced Nuki Configuration</h3>");
|
response.print("<h3>Advanced Nuki Configuration</h3>");
|
||||||
response.print("<table>");
|
response.print("<table>");
|
||||||
@@ -6186,8 +6175,6 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request, PsychicResponse*
|
|||||||
response.print("Disabled");
|
response.print("Disabled");
|
||||||
}
|
}
|
||||||
response.print("\n\n------------ BLUETOOTH ------------");
|
response.print("\n\n------------ BLUETOOTH ------------");
|
||||||
response.print("\nBluetooth connection mode: ");
|
|
||||||
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: ");
|
||||||
|
|||||||
@@ -1107,8 +1107,8 @@ void setup()
|
|||||||
|
|
||||||
if(esp_reset_reason() == esp_reset_reason_t::ESP_RST_PANIC ||
|
if(esp_reset_reason() == esp_reset_reason_t::ESP_RST_PANIC ||
|
||||||
esp_reset_reason() == esp_reset_reason_t::ESP_RST_INT_WDT ||
|
esp_reset_reason() == esp_reset_reason_t::ESP_RST_INT_WDT ||
|
||||||
esp_reset_reason() == esp_reset_reason_t::ESP_RST_TASK_WDT ||
|
esp_reset_reason() == esp_reset_reason_t::ESP_RST_TASK_WDT)
|
||||||
esp_reset_reason() == esp_reset_reason_t::ESP_RST_WDT)
|
//|| esp_reset_reason() == esp_reset_reason_t::ESP_RST_WDT)
|
||||||
{
|
{
|
||||||
logCoreDump();
|
logCoreDump();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
void NetworkDevice::init()
|
void NetworkDevice::init()
|
||||||
{
|
{
|
||||||
|
_useEncryption = false;
|
||||||
|
|
||||||
if(_preferences->getBool(preference_mqtt_ssl_enabled, false)) {
|
if(_preferences->getBool(preference_mqtt_ssl_enabled, false)) {
|
||||||
if (!SPIFFS.begin(true)) {
|
if (!SPIFFS.begin(true)) {
|
||||||
Log->println("SPIFFS Mount Failed");
|
Log->println("SPIFFS Mount Failed");
|
||||||
@@ -265,6 +267,21 @@ void NetworkDevice::mqttDisable()
|
|||||||
_mqttEnabled = false;
|
_mqttEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkDevice::mqttRestart()
|
||||||
|
{
|
||||||
|
if (_useEncryption)
|
||||||
|
{
|
||||||
|
delete _mqttClientSecure;
|
||||||
|
_mqttClientSecure = nullptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete _mqttClient;
|
||||||
|
_mqttClient = nullptr;
|
||||||
|
}
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
bool NetworkDevice::isEncrypted()
|
bool NetworkDevice::isEncrypted()
|
||||||
{
|
{
|
||||||
return _useEncryption;
|
return _useEncryption;
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public:
|
|||||||
virtual bool mqttConnect();
|
virtual bool mqttConnect();
|
||||||
virtual bool mqttDisconnect(bool force);
|
virtual bool mqttDisconnect(bool force);
|
||||||
virtual void mqttDisable();
|
virtual void mqttDisable();
|
||||||
|
virtual void mqttRestart();
|
||||||
virtual bool mqttConnected() const;
|
virtual bool mqttConnected() const;
|
||||||
|
|
||||||
virtual uint16_t mqttPublish(const char* topic, uint8_t qos, bool retain, const char* payload);
|
virtual uint16_t mqttPublish(const char* topic, uint8_t qos, bool retain, const char* payload);
|
||||||
|
|||||||
Reference in New Issue
Block a user