minor changes to reporting

This commit is contained in:
proddy
2020-10-20 21:07:34 +02:00
parent 73008bfe5f
commit 31a2367740
2 changed files with 3 additions and 3 deletions

View File

@@ -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)

View File

@@ -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<const MqttMessage> queue_message(const uint8_t operation, const std::string & topic, const std::string & payload, bool retain);