disable presence detection

This commit is contained in:
technyon
2024-07-09 13:30:51 +02:00
parent 8f679c45a5
commit 0a799e1659
3 changed files with 8 additions and 0 deletions

View File

@@ -116,7 +116,9 @@ void NukiWrapper::initialize(const bool& firstStart)
_preferences->putInt(preference_query_interval_configuration, 3600); _preferences->putInt(preference_query_interval_configuration, 3600);
_preferences->putInt(preference_query_interval_battery, 1800); _preferences->putInt(preference_query_interval_battery, 1800);
_preferences->putInt(preference_query_interval_keypad, 1800); _preferences->putInt(preference_query_interval_keypad, 1800);
#if PRESENCE_DETECTION_ENABLED
_preferences->putInt(preference_presence_detection_timeout, -1); _preferences->putInt(preference_presence_detection_timeout, -1);
#endif
} }
if(_nrOfRetries < 0 || _nrOfRetries == 200) if(_nrOfRetries < 0 || _nrOfRetries == 200)

View File

@@ -1025,11 +1025,13 @@ bool WebCfgServer::processArgs(String& message)
_preferences->putInt(preference_command_retry_delay, value.toInt()); _preferences->putInt(preference_command_retry_delay, value.toInt());
configChanged = true; configChanged = true;
} }
#if PRESENCE_DETECTION_ENABLED
else if(key == "PRDTMO") else if(key == "PRDTMO")
{ {
_preferences->putInt(preference_presence_detection_timeout, value.toInt()); _preferences->putInt(preference_presence_detection_timeout, value.toInt());
configChanged = true; configChanged = true;
} }
#endif
else if(key == "RSBC") else if(key == "RSBC")
{ {
_preferences->putInt(preference_restart_ble_beacon_lost, value.toInt()); _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, ""); 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(_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(_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, ""); 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, ""); printInputField(response, "RSBC", "Restart if bluetooth beacons not received (seconds; -1 to disable)", _preferences->getInt(preference_restart_ble_beacon_lost), 10, "");
response.concat("</table>"); response.concat("</table>");
response.concat("<br><input type=\"submit\" name=\"submit\" value=\"Save\">"); response.concat("<br><input type=\"submit\" name=\"submit\" value=\"Save\">");

View File

@@ -363,11 +363,13 @@ void setup()
bleScanner->initialize("NukiHub"); bleScanner->initialize("NukiHub");
bleScanner->setScanDuration(10); bleScanner->setScanDuration(10);
#if PRESENCE_DETECTION_ENABLED
if(preferences->getInt(preference_presence_detection_timeout) >= 0) if(preferences->getInt(preference_presence_detection_timeout) >= 0)
{ {
presenceDetection = new PresenceDetection(preferences, bleScanner, CharBuffer::get(), buffer_size); presenceDetection = new PresenceDetection(preferences, bleScanner, CharBuffer::get(), buffer_size);
presenceDetection->initialize(); presenceDetection->initialize();
} }
#endif
lockEnabled = preferences->getBool(preference_lock_enabled); lockEnabled = preferences->getBool(preference_lock_enabled);
openerEnabled = preferences->getBool(preference_opener_enabled); openerEnabled = preferences->getBool(preference_opener_enabled);