remove remaining presence detection code

This commit is contained in:
technyon
2024-07-10 16:32:54 +02:00
parent 181455596c
commit cad5ec6d48
3 changed files with 10 additions and 0 deletions

View File

@@ -425,6 +425,7 @@ bool NukiNetwork::update()
_lastConnectedTs = ts;
#if PRESENCE_DETECTION_ENABLED
if(_presenceDetection != nullptr && (_lastPresenceTs == 0 || (ts - _lastPresenceTs) > 3000))
{
char* presenceCsv = _presenceDetection->generateCsv();
@@ -437,6 +438,7 @@ bool NukiNetwork::update()
_lastPresenceTs = ts;
}
#endif
if(_device->signalStrength() != 127 && _rssiPublishInterval > 0 && ts - _lastRssiTs > _rssiPublishInterval)
{
@@ -760,11 +762,13 @@ void NukiNetwork::gpioActionCallback(const GpioAction &action, const int &pin)
_gpioTs[pin] = millis();
}
#if PRESENCE_DETECTION_ENABLED
void NukiNetwork::setMqttPresencePath(char *path)
{
memset(_mqttPresencePrefix, 0, sizeof(_mqttPresencePrefix));
strcpy(_mqttPresencePrefix, path);
}
#endif
void NukiNetwork::disableAutoRestarts()
{

View File

@@ -50,7 +50,9 @@ public:
explicit NukiNetwork(Preferences* preferences, PresenceDetection* presenceDetection, Gpio* gpio, const String& maintenancePathPrefix, char* buffer, size_t bufferSize);
void registerMqttReceiver(MqttReceiver* receiver);
#if PRESENCE_DETECTION_ENABLED
void setMqttPresencePath(char* path);
#endif
void disableAutoRestarts(); // disable on OTA start
void disableMqtt();
@@ -175,7 +177,9 @@ private:
unsigned long _lastConnectedTs = 0;
unsigned long _lastMaintenanceTs = 0;
unsigned long _lastUpdateCheckTs = 0;
#if PRESENCE_DETECTION_ENABLED
unsigned long _lastPresenceTs = 0;
#endif
unsigned long _lastRssiTs = 0;
bool _mqttEnabled = true;
long _rssiPublishInterval = 0;

View File

@@ -55,7 +55,9 @@ void NukiNetworkLock::initialize()
_preferences->putString(preference_mqtt_lock_path, _mqttPath);
}
#if PRESENCE_DETECTION_ENABLED
_network->setMqttPresencePath(_mqttPath);
#endif
_haEnabled = _preferences->getString(preference_mqtt_hass_discovery) != "";