diff --git a/NukiOpenerWrapper.cpp b/NukiOpenerWrapper.cpp index 67eb043..734d7db 100644 --- a/NukiOpenerWrapper.cpp +++ b/NukiOpenerWrapper.cpp @@ -493,8 +493,10 @@ LockActionResult NukiOpenerWrapper::onLockActionReceivedCallback(const char *val nukiOpenerPreferences = new Preferences(); nukiOpenerPreferences->begin("nukihub", true); + uint32_t aclPrefs[17]; + nukiLockPreferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs)); - if((action == NukiOpener::LockAction::ActivateRTO && nukiOpenerPreferences->getBool(preference_acl_act_rto)) || (action == NukiOpener::LockAction::DeactivateRTO && nukiOpenerPreferences->getBool(preference_acl_deact_rto)) || (action == NukiOpener::LockAction::ElectricStrikeActuation && nukiOpenerPreferences->getBool(preference_acl_act_esa)) || (action == NukiOpener::LockAction::ActivateCM && nukiOpenerPreferences->getBool(preference_acl_act_cm)) || (action == NukiOpener::LockAction::DeactivateCM && nukiOpenerPreferences->getBool(preference_acl_deact_cm)) || (action == NukiOpener::LockAction::FobAction1 && nukiOpenerPreferences->getBool(preference_acl_opn_fob1)) || (action == NukiOpener::LockAction::FobAction2 && nukiOpenerPreferences->getBool(preference_acl_opn_fob2)) || (action == NukiOpener::LockAction::FobAction3 && nukiOpenerPreferences->getBool(preference_acl_opn_fob3))) + if((action == NukiOpener::LockAction::ActivateRTO && aclPrefs[9] == 1) || (action == NukiOpener::LockAction::DeactivateRTO && aclPrefs[10] == 1) || (action == NukiOpener::LockAction::ElectricStrikeActuation && aclPrefs[11] == 1) || (action == NukiOpener::LockAction::ActivateCM && aclPrefs[12] == 1) || (action == NukiOpener::LockAction::DeactivateCM && aclPrefs[13] == 1) || (action == NukiOpener::LockAction::FobAction1 && aclPrefs[14] == 1) || (action == NukiOpener::LockAction::FobAction2 && aclPrefs[15] == 1) || (action == NukiOpener::LockAction::FobAction3 && aclPrefs[16] == 1)) { nukiOpenerPreferences->end(); nukiOpenerInst->_nextLockAction = action; diff --git a/NukiWrapper.cpp b/NukiWrapper.cpp index 916d705..44b0bad 100644 --- a/NukiWrapper.cpp +++ b/NukiWrapper.cpp @@ -68,25 +68,10 @@ void NukiWrapper::initialize(const bool& firstStart) _preferences->putInt(preference_command_retry_delay, 1000); _preferences->putInt(preference_restart_ble_beacon_lost, 60); _preferences->putBool(preference_admin_enabled, true); - _preferences->putBool(preference_acl_lock, true); - _preferences->putBool(preference_acl_unlock, true); - _preferences->putBool(preference_acl_unlatch, true); - _preferences->putBool(preference_acl_lockngo, true); - _preferences->putBool(preference_acl_lockngo_unlatch, true); - _preferences->putBool(preference_acl_fulllock, true); - _preferences->putBool(preference_acl_lck_fob1, true); - _preferences->putBool(preference_acl_lck_fob2, true); - _preferences->putBool(preference_acl_lck_fob3, true); - _preferences->putBool(preference_acl_act_rto, true); - _preferences->putBool(preference_acl_deact_rto, true); - _preferences->putBool(preference_acl_act_esa, true); - _preferences->putBool(preference_acl_act_cm, true); - _preferences->putBool(preference_acl_deact_cm, true); - _preferences->putBool(preference_acl_opn_fob1, true); - _preferences->putBool(preference_acl_opn_fob2, true); - _preferences->putBool(preference_acl_opn_fob3, true); + uint32_t aclPrefs[17] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; + _preferences->putBytes(preference_acl, (byte*)(&aclPrefs), sizeof(aclPrefs)); } - + if(_retryDelay <= 100) { _retryDelay = 100; @@ -483,8 +468,10 @@ LockActionResult NukiWrapper::onLockActionReceivedCallback(const char *value) nukiLockPreferences = new Preferences(); nukiLockPreferences->begin("nukihub", true); - - if((action == NukiLock::LockAction::Lock && nukiLockPreferences->getBool(preference_acl_lock)) || (action == NukiLock::LockAction::Unlock && nukiLockPreferences->getBool(preference_acl_unlock)) || (action == NukiLock::LockAction::Unlatch && nukiLockPreferences->getBool(preference_acl_unlatch)) || (action == NukiLock::LockAction::LockNgo && nukiLockPreferences->getBool(preference_acl_lockngo)) || (action == NukiLock::LockAction::LockNgoUnlatch && nukiLockPreferences->getBool(preference_acl_lockngo_unlatch)) || (action == NukiLock::LockAction::FullLock && nukiLockPreferences->getBool(preference_acl_fulllock)) || (action == NukiLock::LockAction::FobAction1 && nukiLockPreferences->getBool(preference_acl_lck_fob1)) || (action == NukiLock::LockAction::FobAction2 && nukiLockPreferences->getBool(preference_acl_lck_fob2)) || (action == NukiLock::LockAction::FobAction3 && nukiLockPreferences->getBool(preference_acl_lck_fob3))) + uint32_t aclPrefs[17]; + nukiLockPreferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs)); + + if((action == NukiLock::LockAction::Lock && aclPrefs[0] == 1) || (action == NukiLock::LockAction::Unlock && aclPrefs[1] == 1) || (action == NukiLock::LockAction::Unlatch && aclPrefs[2] == 1) || (action == NukiLock::LockAction::LockNgo && aclPrefs[3] == 1) || (action == NukiLock::LockAction::LockNgoUnlatch && aclPrefs[4] == 1) || (action == NukiLock::LockAction::FullLock && aclPrefs[5] == 1) || (action == NukiLock::LockAction::FobAction1 && aclPrefs[6] == 1) || (action == NukiLock::LockAction::FobAction2 && aclPrefs[7] == 1) || (action == NukiLock::LockAction::FobAction3 && aclPrefs[8] == 1)) { nukiLockPreferences->end(); nukiInst->_nextLockAction = action; diff --git a/PreferencesKeys.h b/PreferencesKeys.h index f5607e2..06ec03a 100644 --- a/PreferencesKeys.h +++ b/PreferencesKeys.h @@ -47,23 +47,7 @@ #define preference_keypad_info_enabled "kpInfoEnabled" #define preference_keypad_control_enabled "kpCntrlEnabled" #define preference_publish_authdata "pubAuth" -#define preference_acl_lock "aclLckLck" -#define preference_acl_unlock "aclLckUnlck" -#define preference_acl_unlatch "aclLckUnltch" -#define preference_acl_lockngo "aclLckLnG" -#define preference_acl_lockngo_unlatch "aclLckLnGwU" -#define preference_acl_fulllock "aclLckFlck" -#define preference_acl_lck_fob1 "aclLckFob1" -#define preference_acl_lck_fob2 "aclLckFob2" -#define preference_acl_lck_fob3 "aclLckFob3" -#define preference_acl_act_rto "aclOpnActRTO" -#define preference_acl_deact_rto "aclOpnDeactRTO" -#define preference_acl_act_esa "aclOpnActESA" -#define preference_acl_act_cm "aclOpnActCM" -#define preference_acl_deact_cm "aclOpnDeactCM" -#define preference_acl_opn_fob1 "aclOpnFob1" -#define preference_acl_opn_fob2 "aclOpnFob2" -#define preference_acl_opn_fob3 "aclOpnFob3" +#define preference_acl "aclLckOpn" #define preference_register_as_app "regAsApp" // true = register as hub; false = register as app #define preference_command_nr_of_retries "nrRetry" #define preference_command_retry_delay "rtryDelay" @@ -84,7 +68,7 @@ class DebugPreferences private: std::vector _keys = { - preference_started_before, preference_config_version, preference_device_id_lock, preference_device_id_opener, preference_mqtt_broker, + preference_started_before, preference_config_version, preference_device_id_lock, preference_device_id_opener, preference_mqtt_broker, preference_mqtt_broker_port, preference_mqtt_user, preference_mqtt_password, preference_mqtt_log_enabled, preference_check_updates, preference_lock_enabled, preference_mqtt_lock_path, preference_opener_enabled, preference_opener_continuous_mode, preference_mqtt_opener_path, preference_lock_max_keypad_code_count, preference_opener_max_keypad_code_count, preference_mqtt_ca, @@ -94,10 +78,7 @@ private: preference_hostname, preference_network_timeout, preference_restart_on_disconnect, preference_restart_ble_beacon_lost, preference_query_interval_lockstate, preference_query_interval_configuration, preference_query_interval_battery, preference_query_interval_keypad, - preference_keypad_control_enabled, preference_admin_enabled, preference_keypad_info_enabled, preference_acl_lock, - preference_acl_unlock, preference_acl_unlatch, preference_acl_lockngo, preference_acl_lockngo_unlatch, preference_acl_fulllock, - preference_acl_lck_fob1, preference_acl_lck_fob2, preference_acl_lck_fob3, preference_acl_act_rto, preference_acl_deact_rto, - preference_acl_act_esa, preference_acl_act_cm, preference_acl_deact_cm, preference_acl_opn_fob1, preference_acl_opn_fob2, preference_acl_opn_fob3, + preference_keypad_control_enabled, preference_admin_enabled, preference_keypad_info_enabled, preference_acl, preference_access_level, preference_register_as_app, preference_command_nr_of_retries, preference_command_retry_delay, preference_cred_user, preference_cred_password, preference_publish_authdata, preference_publish_debug_info, preference_presence_detection_timeout, @@ -112,10 +93,7 @@ private: std::vector _boolPrefs = { preference_started_before, preference_mqtt_log_enabled, preference_check_updates, preference_lock_enabled, preference_opener_enabled, preference_opener_continuous_mode, - preference_restart_on_disconnect, preference_keypad_control_enabled, preference_admin_enabled, preference_keypad_info_enabled, preference_acl_lock, - preference_acl_unlock, preference_acl_unlatch, preference_acl_lockngo, preference_acl_lockngo_unlatch, preference_acl_fulllock, - preference_acl_lck_fob1, preference_acl_lck_fob2, preference_acl_lck_fob3, preference_acl_act_rto, preference_acl_deact_rto, - preference_acl_act_esa, preference_acl_act_cm, preference_acl_deact_cm, preference_acl_opn_fob1, preference_acl_opn_fob2, preference_acl_opn_fob3, + preference_restart_on_disconnect, preference_keypad_control_enabled, preference_admin_enabled, preference_keypad_info_enabled, preference_register_as_app, preference_ip_dhcp_enabled, preference_publish_authdata, preference_has_mac_saved, preference_publish_debug_info, preference_network_wifi_fallback_disabled }; diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index a963c40..752219e 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -259,8 +259,10 @@ void WebCfgServer::initialize() bool WebCfgServer::processArgs(String& message) { bool configChanged = false; + bool aclLvlChanged = false; bool clearMqttCredentials = false; bool clearCredentials = false; + uint32_t aclPrefs[17] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int count = _server.args(); @@ -459,6 +461,10 @@ bool WebCfgServer::processArgs(String& message) _preferences->putInt(preference_restart_ble_beacon_lost, value.toInt()); configChanged = true; } + else if(key == "aclLvlChanged") + { + aclLvlChanged = true; + } else if(key == "ACLCNF") { _preferences->putBool(preference_admin_enabled, (value == "1")); @@ -473,96 +479,79 @@ bool WebCfgServer::processArgs(String& message) { _preferences->putBool(preference_keypad_control_enabled, (value == "1")); configChanged = true; - } + } else if(key == "PUBAUTH") { _preferences->putBool(preference_publish_authdata, (value == "1")); configChanged = true; - } + } else if(key == "ACLLCKLCK") { - _preferences->putBool(preference_acl_lock, (value == "1")); - configChanged = true; + aclPrefs[0] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKUNLCK") { - _preferences->putBool(preference_acl_unlock, (value == "1")); - configChanged = true; + aclPrefs[1] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKUNLTCH") { - _preferences->putBool(preference_acl_unlatch, (value == "1")); - configChanged = true; + aclPrefs[2] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKLNG") { - _preferences->putBool(preference_acl_lockngo, (value == "1")); - configChanged = true; + aclPrefs[3] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKLNGU") { - _preferences->putBool(preference_acl_lockngo_unlatch, (value == "1")); - configChanged = true; + aclPrefs[4] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKFLLCK") { - _preferences->putBool(preference_acl_fulllock, (value == "1")); - configChanged = true; + aclPrefs[5] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKFOB1") { - _preferences->putBool(preference_acl_lck_fob1, (value == "1")); - configChanged = true; + aclPrefs[6] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKFOB2") { - _preferences->putBool(preference_acl_lck_fob2, (value == "1")); - configChanged = true; + aclPrefs[7] = ((value == "1") ? 1 : 0); } else if(key == "ACLLCKFOB3") { - _preferences->putBool(preference_acl_lck_fob3, (value == "1")); - configChanged = true; + aclPrefs[8] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNUNLCK") { - _preferences->putBool(preference_acl_act_rto, (value == "1")); - configChanged = true; + aclPrefs[9] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNLCK") { - _preferences->putBool(preference_acl_deact_rto, (value == "1")); - configChanged = true; + aclPrefs[10] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNUNLTCH") { - _preferences->putBool(preference_acl_act_esa, (value == "1")); - configChanged = true; + aclPrefs[11] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNUNLCKCM") { - _preferences->putBool(preference_acl_act_cm, (value == "1")); - configChanged = true; + aclPrefs[12] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNLCKCM") { - _preferences->putBool(preference_acl_deact_cm, (value == "1")); - configChanged = true; + aclPrefs[13] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNFOB1") { - _preferences->putBool(preference_acl_opn_fob1, (value == "1")); - configChanged = true; + aclPrefs[14] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNFOB2") { - _preferences->putBool(preference_acl_opn_fob2, (value == "1")); - configChanged = true; + aclPrefs[15] = ((value == "1") ? 1 : 0); } else if(key == "ACLOPNFOB3") { - _preferences->putBool(preference_acl_opn_fob3, (value == "1")); - configChanged = true; + aclPrefs[16] = ((value == "1") ? 1 : 0); } else if(key == "REGAPP") { @@ -646,6 +635,12 @@ bool WebCfgServer::processArgs(String& message) _preferences->putString(preference_cred_password, ""); configChanged = true; } + + if(aclLvlChanged) + { + preferences->putBytes(preference_acl, (byte*)(&aclPrefs), sizeof(aclPrefs)); + configChanged = true; + } if(configChanged) { @@ -936,8 +931,11 @@ void WebCfgServer::buildMqttConfigHtml(String &response) void WebCfgServer::buildAccLvlHtml(String &response) { buildHtmlHeader(response); + uint32_t aclPrefs[17]; + _preferences->getBytes(preference_acl, &aclPrefs, sizeof(aclPrefs)); response.concat("
"); + response.concat(""); response.concat("

Nuki General Access Control

"); response.concat(""); printCheckBox(response, "ACLCNF", "Change Nuki configuration", _preferences->getBool(preference_admin_enabled)); @@ -953,15 +951,15 @@ void WebCfgServer::buildAccLvlHtml(String &response) response.concat("

Nuki Lock Access Control

"); response.concat("
SettingEnabled
"); - printCheckBox(response, "ACLLCKLCK", "Lock", _preferences->getBool(preference_acl_lock)); - printCheckBox(response, "ACLLCKUNLCK", "Unlock", _preferences->getBool(preference_acl_unlock)); - printCheckBox(response, "ACLLCKUNLTCH", "Unlatch", _preferences->getBool(preference_acl_unlatch)); - printCheckBox(response, "ACLLCKLNG", "Lock N Go", _preferences->getBool(preference_acl_lockngo)); - printCheckBox(response, "ACLLCKLNGU", "Lock N Go Unlatch", _preferences->getBool(preference_acl_lockngo_unlatch)); - printCheckBox(response, "ACLLCKFLLCK", "Full Lock", _preferences->getBool(preference_acl_fulllock)); - printCheckBox(response, "ACLLCKFOB1", "Fob Action 1", _preferences->getBool(preference_acl_lck_fob1)); - printCheckBox(response, "ACLLCKFOB2", "Fob Action 2", _preferences->getBool(preference_acl_lck_fob2)); - printCheckBox(response, "ACLLCKFOB3", "Fob Action 3", _preferences->getBool(preference_acl_lck_fob3)); + printCheckBox(response, "ACLLCKLCK", "Lock", (aclPrefs[0] == "1")); + printCheckBox(response, "ACLLCKUNLCK", "Unlock", (aclPrefs[1] == "1")); + printCheckBox(response, "ACLLCKUNLTCH", "Unlatch", (aclPrefs[2] == "1")); + printCheckBox(response, "ACLLCKLNG", "Lock N Go", (aclPrefs[3] == "1")); + printCheckBox(response, "ACLLCKLNGU", "Lock N Go Unlatch", (aclPrefs[4] == "1")); + printCheckBox(response, "ACLLCKFLLCK", "Full Lock", (aclPrefs[5] == "1")); + printCheckBox(response, "ACLLCKFOB1", "Fob Action 1", (aclPrefs[6] == "1")); + printCheckBox(response, "ACLLCKFOB2", "Fob Action 2", (aclPrefs[7] == "1")); + printCheckBox(response, "ACLLCKFOB3", "Fob Action 3", (aclPrefs[8] == "1")); response.concat("
ActionAllowed

"); } if(_nukiOpener != nullptr) @@ -969,14 +967,14 @@ void WebCfgServer::buildAccLvlHtml(String &response) response.concat("

Nuki Opener Access Control

"); response.concat(""); - printCheckBox(response, "ACLOPNUNLCK", "Activate Ring-to-Open", _preferences->getBool(preference_acl_act_rto)); - printCheckBox(response, "ACLOPNLCK", "Deactivate Ring-to-Open", _preferences->getBool(preference_acl_deact_rto)); - printCheckBox(response, "ACLOPNUNLTCH", "Electric Strike Actuation", _preferences->getBool(preference_acl_act_esa)); - printCheckBox(response, "ACLOPNUNLCKCM", "Activate Continuous Mode", _preferences->getBool(preference_acl_act_cm)); - printCheckBox(response, "ACLOPNLCKCM", "Deactivate Continuous Mode", _preferences->getBool(preference_acl_deact_cm)); - printCheckBox(response, "ACLOPNFOB1", "Fob Action 1", _preferences->getBool(preference_acl_opn_fob1)); - printCheckBox(response, "ACLOPNFOB2", "Fob Action 2", _preferences->getBool(preference_acl_opn_fob2)); - printCheckBox(response, "ACLOPNFOB3", "Fob Action 3", _preferences->getBool(preference_acl_opn_fob3)); + printCheckBox(response, "ACLOPNUNLCK", "Activate Ring-to-Open", (aclPrefs[9] == "1")); + printCheckBox(response, "ACLOPNLCK", "Deactivate Ring-to-Open", (aclPrefs[10] == "1")); + printCheckBox(response, "ACLOPNUNLTCH", "Electric Strike Actuation", (aclPrefs[11] == "1")); + printCheckBox(response, "ACLOPNUNLCKCM", "Activate Continuous Mode", (aclPrefs[12] == "1")); + printCheckBox(response, "ACLOPNLCKCM", "Deactivate Continuous Mode", (aclPrefs[13] == "1")); + printCheckBox(response, "ACLOPNFOB1", "Fob Action 1", (aclPrefs[14] == "1")); + printCheckBox(response, "ACLOPNFOB2", "Fob Action 2", (aclPrefs[15] == "1")); + printCheckBox(response, "ACLOPNFOB3", "Fob Action 3", (aclPrefs[16] == "1")); response.concat("
ActionAllowed

"); } response.concat("
"); diff --git a/main.cpp b/main.cpp index 6f7479a..eaf0af0 100644 --- a/main.cpp +++ b/main.cpp @@ -163,73 +163,38 @@ bool initPreferences() { preferences->putBool(preference_keypad_info_enabled, false); } - + + uint32_t aclPrefs[17]; + switch(preferences->getInt(preference_access_level)) { case 0: preferences->putBool(preference_keypad_control_enabled, true); preferences->putBool(preference_admin_enabled, true); - preferences->putBool(preference_acl_lock, true); - preferences->putBool(preference_acl_unlock, true); - preferences->putBool(preference_acl_unlatch, true); - preferences->putBool(preference_acl_lockngo, true); - preferences->putBool(preference_acl_lockngo_unlatch, true); - preferences->putBool(preference_acl_fulllock, true); - preferences->putBool(preference_acl_lck_fob1, true); - preferences->putBool(preference_acl_lck_fob2, true); - preferences->putBool(preference_acl_lck_fob3, true); - preferences->putBool(preference_acl_act_rto, true); - preferences->putBool(preference_acl_deact_rto, true); - preferences->putBool(preference_acl_act_esa, true); - preferences->putBool(preference_acl_act_cm, true); - preferences->putBool(preference_acl_deact_cm, true); - preferences->putBool(preference_acl_opn_fob1, true); - preferences->putBool(preference_acl_opn_fob2, true); - preferences->putBool(preference_acl_opn_fob3, true); + + aclPrefs = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; break; case 1: preferences->putBool(preference_keypad_control_enabled, false); preferences->putBool(preference_admin_enabled, false); - preferences->putBool(preference_acl_lock, true); - preferences->putBool(preference_acl_unlock, false); - preferences->putBool(preference_acl_unlatch, false); - preferences->putBool(preference_acl_lockngo, false); - preferences->putBool(preference_acl_lockngo_unlatch, false); - preferences->putBool(preference_acl_fulllock, true); - preferences->putBool(preference_acl_lck_fob1, false); - preferences->putBool(preference_acl_lck_fob2, false); - preferences->putBool(preference_acl_lck_fob3, false); - preferences->putBool(preference_acl_act_rto, false); - preferences->putBool(preference_acl_deact_rto, true); - preferences->putBool(preference_acl_act_esa, false); - preferences->putBool(preference_acl_act_cm, false); - preferences->putBool(preference_acl_deact_cm, true); - preferences->putBool(preference_acl_opn_fob1, false); - preferences->putBool(preference_acl_opn_fob2, false); - preferences->putBool(preference_acl_opn_fob3, false); + + aclPrefs = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0}; + break; + case 2: + preferences->putBool(preference_keypad_control_enabled, false); + preferences->putBool(preference_admin_enabled, false); + + aclPrefs = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; break; case 3: preferences->putBool(preference_keypad_control_enabled, false); preferences->putBool(preference_admin_enabled, false); - preferences->putBool(preference_acl_lock, true); - preferences->putBool(preference_acl_unlock, true); - preferences->putBool(preference_acl_unlatch, false); - preferences->putBool(preference_acl_lockngo, true); - preferences->putBool(preference_acl_lockngo_unlatch, false); - preferences->putBool(preference_acl_fulllock, true); - preferences->putBool(preference_acl_lck_fob1, false); - preferences->putBool(preference_acl_lck_fob2, false); - preferences->putBool(preference_acl_lck_fob3, false); - preferences->putBool(preference_acl_act_rto, true); - preferences->putBool(preference_acl_deact_rto, true); - preferences->putBool(preference_acl_act_esa, false); - preferences->putBool(preference_acl_act_cm, true); - preferences->putBool(preference_acl_deact_cm, true); - preferences->putBool(preference_acl_opn_fob1, false); - preferences->putBool(preference_acl_opn_fob2, false); - preferences->putBool(preference_acl_opn_fob3, false); + + aclPrefs = {1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0}; break; } + + preferences->putBytes(preference_acl, (byte*)(&aclPrefs), sizeof(aclPrefs)); } preferences->putInt(preference_config_version, atof(NUKI_HUB_VERSION) * 100);