From 31a2367740fbdef30d7619ea4aedfe1f3eadddee Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 20 Oct 2020 21:07:34 +0200 Subject: [PATCH] minor changes to reporting --- src/mqtt.cpp | 4 ++-- src/mqtt.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 2c703e118..d47bc82ff 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -735,7 +735,7 @@ void Mqtt::register_mqtt_ha_binary_sensor(const __FlashStringHelper * name, cons #if defined(EMSESP_STANDALONE) LOG_DEBUG(F("Publishing topic %s"), topic); #else - if (packet_id == 0) { + if (!packet_id) { LOG_ERROR(F("Failed to publish topic %s"), topic); } else { LOG_DEBUG(F("Publishing topic %s"), topic); @@ -822,7 +822,7 @@ void Mqtt::register_mqtt_ha_sensor(const char * prefix, std::string payload_text; serializeJson(doc, payload_text); // convert json to string uint16_t packet_id = mqttClient_->publish(topic, 0, true, payload_text.c_str(), payload_text.size()); - if (packet_id == 0) { + if (!packet_id) { LOG_ERROR(F("Failed to publish topic %s"), topic); } else { #if defined(EMSESP_STANDALONE) diff --git a/src/mqtt.h b/src/mqtt.h index c273a767f..b50d9d077 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -176,7 +176,7 @@ class Mqtt { static uint16_t mqtt_message_id_; static constexpr size_t MAX_MQTT_MESSAGES = 70; // size of queue - static constexpr uint32_t MQTT_PUBLISH_WAIT = 100; // delay between sending publishes, to account for large payloads + static constexpr uint32_t MQTT_PUBLISH_WAIT = 200; // delay between sending publishes, to account for large payloads static constexpr uint8_t MQTT_PUBLISH_MAX_RETRY = 3; // max retries for giving up on publishing static std::shared_ptr queue_message(const uint8_t operation, const std::string & topic, const std::string & payload, bool retain);