diff --git a/NukiWrapper.cpp b/NukiWrapper.cpp
index 9b6df33..502fea4 100644
--- a/NukiWrapper.cpp
+++ b/NukiWrapper.cpp
@@ -144,6 +144,12 @@ void NukiWrapper::setPin(const uint16_t pin)
_nukiBle.saveSecurityPincode(pin);
}
+void NukiWrapper::unpair()
+{
+ _nukiBle.unPairNuki();
+ _paired = false;
+}
+
void NukiWrapper::updateKeyTurnerState()
{
_nukiBle.requestKeyTurnerState(&_keyTurnerState);
diff --git a/NukiWrapper.h b/NukiWrapper.h
index ec3bf86..a62376b 100644
--- a/NukiWrapper.h
+++ b/NukiWrapper.h
@@ -17,6 +17,8 @@ public:
void setPin(const uint16_t pin);
+ void unpair();
+
const Nuki::KeyTurnerState& keyTurnerState();
const bool isPaired();
diff --git a/Version.h b/Version.h
index acf6488..3a47e2c 100644
--- a/Version.h
+++ b/Version.h
@@ -1,3 +1,3 @@
#pragma once
-#define nuki_hub_version "2.4"
\ No newline at end of file
+#define nuki_hub_version "2.5"
\ No newline at end of file
diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp
index 55299fe..1d65999 100644
--- a/WebCfgServer.cpp
+++ b/WebCfgServer.cpp
@@ -10,6 +10,8 @@ WebCfgServer::WebCfgServer(NukiWrapper* nuki, Network* network, EthServer* ethSe
_preferences(preferences),
_allowRestartToPortal(allowRestartToPortal)
{
+ _confirmCode = generateConfirmCode();
+
String str = _preferences->getString(preference_cred_user);
if(str.length() > 0)
@@ -51,6 +53,13 @@ void WebCfgServer::initialize()
buildConfigureWifiHtml(response);
_server.send(200, "text/html", response);
});
+ _server.on("/unpair", [&]() {
+ if (_hasCredentials && !_server.authenticate(_credUser, _credPassword)) {
+ return _server.requestAuthentication();
+ }
+
+ processUnpair();
+ });
_server.on("/wifimanager", [&]() {
if (_hasCredentials && !_server.authenticate(_credUser, _credPassword)) {
return _server.requestAuthentication();
@@ -320,6 +329,15 @@ void WebCfgServer::buildCredHtml(String &response)
response.concat("
");
response.concat("");
+ _confirmCode = generateConfirmCode();
+ response.concat("