dont allow not_connected_publish, fix mqtt success/fail counters, v3.7.0-dev1a

This commit is contained in:
MichaelDvP
2023-08-30 12:19:55 +02:00
parent f6a4da0584
commit d0c368f6a0
4 changed files with 5 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ the LICENSE file.
#endif #endif
#ifndef EMC_ALLOW_NOT_CONNECTED_PUBLISH #ifndef EMC_ALLOW_NOT_CONNECTED_PUBLISH
#define EMC_ALLOW_NOT_CONNECTED_PUBLISH 1 #define EMC_ALLOW_NOT_CONNECTED_PUBLISH 0
#endif #endif
#ifndef EMC_WAIT_FOR_CONNACK #ifndef EMC_WAIT_FOR_CONNACK

View File

@@ -506,7 +506,7 @@ void Mqtt::on_connect() {
// publish to the last will topic (see Mqtt::start() function) to say we're alive // publish to the last will topic (see Mqtt::start() function) to say we're alive
queue_publish_retain("status", "online", true); // with retain on queue_publish_retain("status", "online", true); // with retain on
mqtt_publish_fails_ = 0; // reset fail count to 0 // mqtt_publish_fails_ = 0; // reset fail count to 0
} }
// Home Assistant Discovery - the main master Device called EMS-ESP // Home Assistant Discovery - the main master Device called EMS-ESP

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.0-dev.1" #define EMSESP_APP_VERSION "3.7.0-dev.1a"

View File

@@ -166,9 +166,9 @@ void WebStatusService::webStatusService(AsyncWebServerRequest * request) {
if (Mqtt::enabled()) { if (Mqtt::enabled()) {
statJson = statsJson.createNestedObject(); statJson = statsJson.createNestedObject();
statJson["id"] = 5; statJson["id"] = 5;
statJson["s"] = Mqtt::publish_count(); statJson["s"] = Mqtt::publish_count() - Mqtt::publish_fails();
statJson["f"] = Mqtt::publish_fails(); statJson["f"] = Mqtt::publish_fails();
statJson["q"] = Mqtt::publish_count() == 0 ? 100 : 100 - (uint8_t)((100 * Mqtt::publish_fails()) / (Mqtt::publish_count() + Mqtt::publish_fails())); statJson["q"] = Mqtt::publish_count() == 0 ? 100 : 100 - (uint8_t)((100 * Mqtt::publish_fails()) / Mqtt::publish_count());
} }
statJson = statsJson.createNestedObject(); statJson = statsJson.createNestedObject();