experimental mqtt client supporting large packets

This commit is contained in:
proddy
2021-02-27 14:45:51 +01:00
parent 333c5c16c0
commit ce45374b54
28 changed files with 1358 additions and 1046 deletions

View File

@@ -656,7 +656,6 @@ void Mqtt::publish_ha(const __FlashStringHelper * topic, const JsonObject & payl
}
// publish a Home Assistant config topic and payload, with retain flag off.
// for ESP32 its added to the queue, for ESP8266 is sent immediatelty
void Mqtt::publish_ha(const std::string & topic, const JsonObject & payload) {
if (!enabled()) {
return;
@@ -676,20 +675,7 @@ void Mqtt::publish_ha(const std::string & topic, const JsonObject & payload) {
#endif
// queue messages if the MQTT connection is not yet established. to ensure we don't miss messages
bool queued = !connected();
if (queued) {
queue_publish_message(topic, payload_text, true); // with retain true
return;
}
// send immediately and then wait a while
if (!mqttClient_->publish(topic.c_str(), 0, true, payload_text.c_str())) {
LOG_ERROR(F("Failed to publish topic %s"), topic.c_str());
mqtt_publish_fails_++; // increment failure counter
}
delay(MQTT_HA_PUBLISH_DELAY); // enough time to send the short message out
queue_publish_message(topic, payload_text, true); // with retain true
}
// take top from queue and perform the publish or subscribe action

View File

@@ -42,13 +42,7 @@ using uuid::console::Shell;
#define MQTT_HA_PUBLISH_DELAY 50
// size of queue
#if defined(EMSESP_STANDALONE)
#define MAX_MQTT_MESSAGES 70
#elif defined(ESP32)
#define MAX_MQTT_MESSAGES 100
#else
#define MAX_MQTT_MESSAGES 20
#endif
enum { BOOL_FORMAT_ONOFF = 1, BOOL_FORMAT_TRUEFALSE, BOOL_FORMAT_10 }; // matches Web UI settings

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.0.0b2"
#define EMSESP_APP_VERSION "3.0.0b3"