From f7325bfa10c7cacabb76e58fcd2e1622a9e1b589 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 10 Aug 2020 14:47:05 +0800 Subject: [PATCH] mqtt: esp_mqtt_client_publish now returns msd id for QoS>0 when offline --- mqtt_client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mqtt_client.c b/mqtt_client.c index edfec7a..4a6b7d5 100644 --- a/mqtt_client.c +++ b/mqtt_client.c @@ -1634,6 +1634,9 @@ int esp_mqtt_client_publish(esp_mqtt_client_handle_t client, const char *topic, /* Skip sending if not connected (rely on resending) */ if (client->state != MQTT_STATE_CONNECTED) { ESP_LOGD(TAG, "Publish: client is not connected"); + if (qos > 0) { + ret = pending_msg_id; + } goto cannot_publish; }