Skip to content

Commit

Permalink
dont allow not_connected_publish, fix mqtt success/fail counters, v3.…
Browse files Browse the repository at this point in the history
…7.0-dev1a
  • Loading branch information
MichaelDvP committed Aug 30, 2023
1 parent f6a4da0 commit d0c368f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/espMqttClient/src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.0-dev.1"
#define EMSESP_APP_VERSION "3.7.0-dev.1a"
4 changes: 2 additions & 2 deletions src/web/WebStatusService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d0c368f

Please sign in to comment.