Fixes/Enhancement for MQTT and WiFi reconnect + network timout + MQTT retain (#419)

* Retain

* Reconnect
This commit is contained in:
iranl
2024-07-09 13:17:31 +02:00
committed by GitHub
parent 8f679c45a5
commit 137b99b291
8 changed files with 90 additions and 66 deletions

View File

@@ -56,12 +56,12 @@ public:
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, bool retain = false);
void publishInt(const char* prefix, const char* topic, const int value, bool retain = false);
void publishUInt(const char* prefix, const char* topic, const unsigned int value, bool retain = false);
void publishULong(const char* prefix, const char* topic, const unsigned long value, bool retain = false);
void publishBool(const char* prefix, const char* topic, const bool value, bool retain = false);
bool publishString(const char* prefix, const char* topic, const char* value, bool retain = false);
void publishFloat(const char* prefix, const char* topic, const float value, bool retain, const uint8_t precision = 2);
void publishInt(const char* prefix, const char* topic, const int value, bool retain);
void publishUInt(const char* prefix, const char* topic, const unsigned int value, bool retain);
void publishULong(const char* prefix, const char* topic, const unsigned long value, bool retain);
void publishBool(const char* prefix, const char* topic, const bool value, bool retain);
bool publishString(const char* prefix, const char* topic, const char* value, bool retain);
void publishHASSConfig(char* deviceType, const char* baseTopic, char* name, char* uidString, const char *softwareVersion, const char *hardwareVersion, const char* availabilityTopic, const bool& hasKeypad, char* lockAction, char* unlockAction, char* openAction);
void publishHASSConfigAdditionalLockEntities(char* deviceType, const char* baseTopic, char* name, char* uidString);
@@ -155,6 +155,7 @@ private:
int _mqttConnectionState = 0;
bool _connectReplyReceived = false;
bool _firstDisconnected = true;
unsigned long _nextReconnect = 0;
char _mqttBrokerAddr[101] = {0};