diff --git a/src/NukiWrapper.cpp b/src/NukiWrapper.cpp
index ccc49a5..2753bc6 100644
--- a/src/NukiWrapper.cpp
+++ b/src/NukiWrapper.cpp
@@ -116,7 +116,9 @@ void NukiWrapper::initialize(const bool& firstStart)
_preferences->putInt(preference_query_interval_configuration, 3600);
_preferences->putInt(preference_query_interval_battery, 1800);
_preferences->putInt(preference_query_interval_keypad, 1800);
+#if PRESENCE_DETECTION_ENABLED
_preferences->putInt(preference_presence_detection_timeout, -1);
+#endif
}
if(_nrOfRetries < 0 || _nrOfRetries == 200)
diff --git a/src/WebCfgServer.cpp b/src/WebCfgServer.cpp
index 77a0ab1..4447211 100644
--- a/src/WebCfgServer.cpp
+++ b/src/WebCfgServer.cpp
@@ -1025,11 +1025,13 @@ bool WebCfgServer::processArgs(String& message)
_preferences->putInt(preference_command_retry_delay, value.toInt());
configChanged = true;
}
+#if PRESENCE_DETECTION_ENABLED
else if(key == "PRDTMO")
{
_preferences->putInt(preference_presence_detection_timeout, value.toInt());
configChanged = true;
}
+#endif
else if(key == "RSBC")
{
_preferences->putInt(preference_restart_ble_beacon_lost, value.toInt());
@@ -2424,7 +2426,9 @@ void WebCfgServer::buildNukiConfigHtml(String &response)
printInputField(response, "TRYDLY", "Delay between retries (milliseconds)", _preferences->getInt(preference_command_retry_delay), 10, "");
if(_nuki != nullptr) printCheckBox(response, "REGAPP", "Lock: Nuki Bridge is running alongside Nuki Hub (needs re-pairing if changed)", _preferences->getBool(preference_register_as_app), "");
if(_nukiOpener != nullptr) printCheckBox(response, "REGAPPOPN", "Opener: Nuki Bridge is running alongside Nuki Hub (needs re-pairing if changed)", _preferences->getBool(preference_register_opener_as_app), "");
+#if PRESENCE_DETECTION_ENABLED
printInputField(response, "PRDTMO", "Presence detection timeout (seconds; -1 to disable)", _preferences->getInt(preference_presence_detection_timeout), 10, "");
+#endif
printInputField(response, "RSBC", "Restart if bluetooth beacons not received (seconds; -1 to disable)", _preferences->getInt(preference_restart_ble_beacon_lost), 10, "");
response.concat("");
response.concat("
");
diff --git a/src/main.cpp b/src/main.cpp
index 3fd7807..7c720c7 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -363,11 +363,13 @@ void setup()
bleScanner->initialize("NukiHub");
bleScanner->setScanDuration(10);
+#if PRESENCE_DETECTION_ENABLED
if(preferences->getInt(preference_presence_detection_timeout) >= 0)
{
presenceDetection = new PresenceDetection(preferences, bleScanner, CharBuffer::get(), buffer_size);
presenceDetection->initialize();
}
+#endif
lockEnabled = preferences->getBool(preference_lock_enabled);
openerEnabled = preferences->getBool(preference_opener_enabled);