ACL Info WebCfg + Force Keypad/DoorSensor

This commit is contained in:
iranl
2024-03-17 22:40:22 +01:00
parent 3db4c0699e
commit 516af39fe6
3 changed files with 57 additions and 7 deletions

View File

@@ -635,7 +635,7 @@ bool WebCfgServer::processArgs(String& message)
_preferences->putString(preference_cred_password, "");
configChanged = true;
}
if(aclLvlChanged)
{
_preferences->putBytes(preference_acl, (byte*)(&aclPrefs), sizeof(aclPrefs));
@@ -939,7 +939,7 @@ void WebCfgServer::buildAccLvlHtml(String &response)
response.concat("<h3>Nuki General Access Control</h3>");
response.concat("<table><tr><th>Setting</th><th>Enabled</th></tr>");
printCheckBox(response, "ACLCNF", "Change Nuki configuration", _preferences->getBool(preference_admin_enabled));
if((_nuki != nullptr && _nuki->hasKeypad()) || (_nukiOpener != nullptr && _nukiOpener->hasKeypad()))
if((_nuki != nullptr && (_preferences->getString(preference_lock_force_keypad) || _nuki->hasKeypad())) || (_nukiOpener != nullptr && (_preferences->getString(preference_opener_force_keypad) || _nukiOpener->hasKeypad())))
{
printCheckBox(response, "KPPUB", "Publish keypad codes information", _preferences->getBool(preference_keypad_info_enabled));
printCheckBox(response, "KPENA", "Add, modify and delete keypad codes", _preferences->getBool(preference_keypad_control_enabled));
@@ -993,11 +993,14 @@ void WebCfgServer::buildNukiConfigHtml(String &response)
if(_preferences->getBool(preference_lock_enabled))
{
printInputField(response, "MQTTPATH", "MQTT Nuki Smartlock Path", _preferences->getString(preference_mqtt_lock_path).c_str(), 180);
printCheckBox(response, "LCKFORCEKPAD", "Force Lock Keypad availability", _preferences->getBool(preference_lock_force_keypad));
printCheckBox(response, "LCKFORCEDRSNSR", "Force Lock Door Sensor availability", _preferences->getBool(preference_lock_force_doorsensor));
}
printCheckBox(response, "OPENA", "Nuki Opener enabled", _preferences->getBool(preference_opener_enabled));
if(_preferences->getBool(preference_opener_enabled))
{
printInputField(response, "MQTTOPPATH", "MQTT Nuki Opener Path", _preferences->getString(preference_mqtt_opener_path).c_str(), 180);
printCheckBox(response, "OPFORCEKPAD", "Force Opener Keypad availability", _preferences->getBool(preference_opener_force_keypad));
}
response.concat("</table><br>");
@@ -1007,7 +1010,7 @@ void WebCfgServer::buildNukiConfigHtml(String &response)
printInputField(response, "LSTINT", "Query interval lock state (seconds)", _preferences->getInt(preference_query_interval_lockstate), 10);
printInputField(response, "CFGINT", "Query interval configuration (seconds)", _preferences->getInt(preference_query_interval_configuration), 10);
printInputField(response, "BATINT", "Query interval battery (seconds)", _preferences->getInt(preference_query_interval_battery), 10);
if((_nuki != nullptr && _nuki->hasKeypad()) || (_nukiOpener != nullptr && _nukiOpener->hasKeypad()))
if((_nuki != nullptr && (_preferences->getString(preference_lock_force_keypad) || _nuki->hasKeypad())) || (_nukiOpener != nullptr && (_preferences->getString(preference_opener_force_keypad) || _nukiOpener->hasKeypad())))
{
printInputField(response, "KPINT", "Query interval keypad (seconds)", _preferences->getInt(preference_query_interval_keypad), 10);
}
@@ -1089,6 +1092,9 @@ void WebCfgServer::buildInfoHtml(String &response)
response.concat("MQTT connected: ");
response.concat(_network->mqttConnectionState() > 0 ? "Yes\n" : "No\n");
uint32_t aclPrefs[17];
_preferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs));
if(_nuki != nullptr)
{
response.concat("Lock firmware version: ");
@@ -1103,7 +1109,26 @@ void WebCfgServer::buildInfoHtml(String &response)
response.concat(_nuki->hasDoorSensor() ? "Yes\n" : "No\n");
response.concat("Lock has keypad: ");
response.concat(_nuki->hasKeypad() ? "Yes\n" : "No\n");
response.concat("Lock ACL (Lock): ");
response.concat((int)aclPrefs[0] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Unlock): ");
response.concat((int)aclPrefs[1] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Unlatch): ");
response.concat((int)aclPrefs[2] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Lock N Go): ");
response.concat((int)aclPrefs[3] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Lock N Go Unlatch): ");
response.concat((int)aclPrefs[4] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Full Lock): ");
response.concat((int)aclPrefs[5] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Fob Action 1): ");
response.concat((int)aclPrefs[6] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Fob Action 2): ");
response.concat((int)aclPrefs[7] ? "Allowed\n" : "Disallowed\n");
response.concat("Lock ACL (Fob Action 3): ");
response.concat((int)aclPrefs[8] ? "Allowed\n" : "Disallowed\n");
}
if(_nukiOpener != nullptr)
{
response.concat("Opener firmware version: ");
@@ -1115,6 +1140,22 @@ void WebCfgServer::buildInfoHtml(String &response)
response.concat(_nukiOpener->isPaired() ? _nukiOpener->isPinSet() ? "Yes\n" : "No\n" : "-\n");
response.concat("Opener has keypad: ");
response.concat(_nukiOpener->hasKeypad() ? "Yes\n" : "No\n");
response.concat("Opener ACL (Activate Ring-to-Open): ");
response.concat((int)aclPrefs[9] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Deactivate Ring-to-Open): ");
response.concat((int)aclPrefs[10] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Electric Strike Actuation): ");
response.concat((int)aclPrefs[11] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Activate Continuous Mode): ");
response.concat((int)aclPrefs[12] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Deactivate Continuous Mode): ");
response.concat((int)aclPrefs[13] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Fob Action 1): ");
response.concat((int)aclPrefs[14] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Fob Action 2): ");
response.concat((int)aclPrefs[15] ? "Allowed\n" : "Disallowed\n");
response.concat("Opener ACL (Fob Action 3): ");
response.concat((int)aclPrefs[16] ? "Allowed\n" : "Disallowed\n");
}
response.concat("Network device: ");