From d0c368f6a084770f717be6ef71b23f345fbdadce Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Wed, 30 Aug 2023 12:19:55 +0200 Subject: [PATCH] dont allow not_connected_publish, fix mqtt success/fail counters, v3.7.0-dev1a --- lib/espMqttClient/src/Config.h | 2 +- src/mqtt.cpp | 2 +- src/version.h | 2 +- src/web/WebStatusService.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/espMqttClient/src/Config.h b/lib/espMqttClient/src/Config.h index f43747421..b8a813c87 100644 --- a/lib/espMqttClient/src/Config.h +++ b/lib/espMqttClient/src/Config.h @@ -37,7 +37,7 @@ the LICENSE file. #endif #ifndef EMC_ALLOW_NOT_CONNECTED_PUBLISH -#define EMC_ALLOW_NOT_CONNECTED_PUBLISH 1 +#define EMC_ALLOW_NOT_CONNECTED_PUBLISH 0 #endif #ifndef EMC_WAIT_FOR_CONNACK diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 77e697af8..a8d8a81b1 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -506,7 +506,7 @@ void Mqtt::on_connect() { // publish to the last will topic (see Mqtt::start() function) to say we're alive 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 diff --git a/src/version.h b/src/version.h index b6cc182cf..47b185da0 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.7.0-dev.1" +#define EMSESP_APP_VERSION "3.7.0-dev.1a" diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 86ec82683..36ee1084f 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -166,9 +166,9 @@ void WebStatusService::webStatusService(AsyncWebServerRequest * request) { if (Mqtt::enabled()) { statJson = statsJson.createNestedObject(); statJson["id"] = 5; - statJson["s"] = Mqtt::publish_count(); + statJson["s"] = Mqtt::publish_count() - 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();