From 34887ddc5d64f2c7603cae23beb042801d2f0fc9 Mon Sep 17 00:00:00 2001 From: lewisxhe Date: Fri, 23 Aug 2024 17:40:43 +0800 Subject: [PATCH] A76xx Set MQTT3.1.1 as the default --- src/TinyGsmMqttA76xx.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/TinyGsmMqttA76xx.h b/src/TinyGsmMqttA76xx.h index a482a9d4..2a881029 100644 --- a/src/TinyGsmMqttA76xx.h +++ b/src/TinyGsmMqttA76xx.h @@ -163,8 +163,12 @@ class TinyGsmMqttA76xx thisModem().waitResponse(3000); thisModem().sendAT("+CMQTTACCQ=", clientIndex, ",\"", clientID, "\",", __ssl); - if (thisModem().waitResponse(3000) != 1)return false; + + // Set MQTT3.1.1 , Default use MQTT 3.1 + thisModem().sendAT("+CMQTTCFG=\"version\",", clientIndex, ",4"); + thisModem().waitResponse(30000UL); + if (username && password) { thisModem().sendAT("+CMQTTCONNECT=", clientIndex, ',', "\"tcp://", server, ':', port, "\",", keepalive_time, ',', 1, ",\"", username, "\",\"", password, "\""); } else {