allow to set opener PIN

This commit is contained in:
technyon
2022-06-01 21:14:50 +02:00
parent fec38ada9c
commit eb4c48405c
2 changed files with 37 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ project(nuki_hub CXX)
# ARDUHAL_LOG_LEVEL_NONE, define ARDUHAL_LOG_LEVEL_ERROR, define ARDUHAL_LOG_LEVEL_WARN, define ARDUHAL_LOG_LEVEL_INFO,
# define ARDUHAL_LOG_LEVEL_DEBUG, define ARDUHAL_LOG_LEVEL_VERBOSE
set(LOG_LEVEL ARDUHAL_LOG_LEVEL_NONE)
set(LOG_LEVEL ARDUHAL_LOG_LEVEL_DEBUG)
include_directories(${PROJECT_NAME}
PRIVATE

View File

@@ -229,15 +229,28 @@ bool WebCfgServer::processArgs(String& message)
{
if(value == "#")
{
message = "PIN cleared";
message = "NUKI Lock PIN cleared";
_nuki->setPin(0xffff);
}
else
{
message = "PIN saved";
message = "NUKI Lock PIN saved";
_nuki->setPin(value.toInt());
}
}
else if(key == "NUKIOPPIN" && _nukiOpener != nullptr)
{
if(value == "#")
{
message = "NUKI Opener PIN cleared";
_nukiOpener->setPin(0xffff);
}
else
{
message = "NUKI Opener PIN saved";
_nukiOpener->setPin(value.toInt());
}
}
}
if(clearMqttCredentials)
@@ -364,13 +377,27 @@ void WebCfgServer::buildCredHtml(String &response)
response.concat("<br><INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Save\">");
response.concat("</FORM>");
response.concat("<br><br><FORM ACTION=method=get >");
response.concat("<h3>NUKI Pin Code</h3>");
response.concat("<table>");
printInputField(response, "NUKIPIN", "PIN Code (# to clear)", "*", 20, true);
response.concat("</table>");
response.concat("<br><INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Save\">");
response.concat("</FORM>");
if(_nuki != nullptr)
{
response.concat("<br><br><FORM ACTION=method=get >");
response.concat("<h3>NUKI Lock PIN</h3>");
response.concat("<table>");
printInputField(response, "NUKIPIN", "PIN Code (# to clear)", "*", 20, true);
response.concat("</table>");
response.concat("<br><INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Save\">");
response.concat("</FORM>");
}
if(_nukiOpener != nullptr)
{
response.concat("<br><br><FORM ACTION=method=get >");
response.concat("<h3>NUKI Opener PIN</h3>");
response.concat("<table>");
printInputField(response, "NUKIOPPIN", "PIN Code (# to clear)", "*", 20, true);
response.concat("</table>");
response.concat("<br><INPUT TYPE=SUBMIT NAME=\"submit\" VALUE=\"Save\">");
response.concat("</FORM>");
}
_confirmCode = generateConfirmCode();
if(_nuki != nullptr)