fix presence detection

This commit is contained in:
technyon
2024-06-15 08:18:12 +02:00
parent a419447f9e
commit 705e0971d7
7 changed files with 47 additions and 75 deletions

View File

@@ -11,6 +11,7 @@
#include <ArduinoJson.h>
#include <HTTPClient.h>
#include "NukiConstants.h"
#include "PresenceDetection.h"
enum class NetworkDeviceType
{
@@ -28,7 +29,7 @@ enum class NetworkDeviceType
class Network
{
public:
explicit Network(Preferences* preferences, Gpio* gpio, const String& maintenancePathPrefix, char* buffer, size_t bufferSize);
explicit Network(Preferences* preferences, PresenceDetection* presenceDetection, Gpio* gpio, const String& maintenancePathPrefix, char* buffer, size_t bufferSize);
void initialize();
bool update();
@@ -79,8 +80,6 @@ public:
void clearWifiFallback();
void publishPresenceDetection(char* csv);
int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed
bool encryptionSupported();
const String networkDeviceName() const;
@@ -133,6 +132,7 @@ private:
HTTPClient https;
Preferences* _preferences;
PresenceDetection* _presenceDetection;
Gpio* _gpio;
IPConfiguration* _ipConfiguration = nullptr;
String _hostname;
@@ -149,7 +149,6 @@ private:
char _maintenancePathPrefix[181] = {0};
int _networkTimeout = 0;
std::vector<MqttReceiver*> _mqttReceivers;
char* _presenceCsv = nullptr;
bool _restartOnDisconnect = false;
bool _firstConnect = true;
bool _publishDebugInfo = false;
@@ -159,6 +158,7 @@ private:
unsigned long _lastConnectedTs = 0;
unsigned long _lastMaintenanceTs = 0;
unsigned long _lastUpdateCheckTs = 0;
unsigned long _lastPresenceTs = 0;
unsigned long _lastRssiTs = 0;
bool _mqttEnabled = true;
static unsigned long _ignoreSubscriptionsTs;