add mqtt maintenance section

This commit is contained in:
technyon
2022-07-23 08:43:18 +02:00
parent f265fbe95a
commit 3ea014956e
6 changed files with 69 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
#include <Preferences.h>
#include <vector>
#include <map>
#include "networkDevices/NetworkDevice.h"
#include "MqttReceiver.h"
@@ -24,9 +25,11 @@ public:
void disableAutoRestarts(); // disable on OTA start
void subscribe(const char* prefix, const char* path);
void initTopic(const char* prefix, const char* path, const char* value);
void publishFloat(const char* prefix, const char* topic, const float value, const uint8_t precision = 2);
void publishInt(const char* prefix, const char* topic, const int value);
void publishUInt(const char* prefix, const char* topic, const unsigned int value);
void publishULong(const char* prefix, const char* topic, const unsigned long value);
void publishBool(const char* prefix, const char* topic, const bool value);
bool publishString(const char* prefix, const char* topic, const char* value);
@@ -57,11 +60,13 @@ private:
char _mqttUser[31] = {0};
char _mqttPass[31] = {0};
char _mqttPresencePrefix[181] = {0};
std::vector<String> _subscribedTopics;
int _networkTimeout = 0;
std::vector<MqttReceiver*> _mqttReceivers;
char* _presenceCsv = nullptr;
bool _restartOnDisconnect = false;
bool _firstConnect = true;
std::vector<String> _subscribedTopics;
std::map<String, String> _initTopics;
unsigned long _lastConnectedTs = 0;
};