From 098de0cb0b7394f3010bf565cdaad82d46fbc0ff Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Tue, 18 Feb 2020 09:46:39 +0300 Subject: [PATCH 1/2] mqtt: pin arduino mqtt version --- code/espurna/mqtt.ino | 1 + code/platformio.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/code/espurna/mqtt.ino b/code/espurna/mqtt.ino index eb8ed9d4..3a210ab3 100644 --- a/code/espurna/mqtt.ino +++ b/code/espurna/mqtt.ino @@ -187,6 +187,7 @@ bool _mqttConnectSyncClient(bool secure = false) { #if MQTT_LIBRARY == MQTT_LIBRARY_ARDUINOMQTT _mqtt.begin(_mqtt_server.c_str(), _mqtt_port, _mqttGetClient(secure)); _mqtt.setWill(_mqtt_will.c_str(), _mqtt_payload_offline.c_str(), _mqtt_retain, _mqtt_qos); + _mqtt.setKeepAlive(_mqtt_keepalive); result = _mqtt.connect(_mqtt_clientid.c_str(), _mqtt_user.c_str(), _mqtt_pass.c_str()); #elif MQTT_LIBRARY == MQTT_LIBRARY_PUBSUBCLIENT _mqtt.setClient(_mqttGetClient(secure)); diff --git a/code/platformio.ini b/code/platformio.ini index 115bfaa2..adcdee41 100644 --- a/code/platformio.ini +++ b/code/platformio.ini @@ -115,7 +115,7 @@ lib_deps = https://github.com/xoseperez/justwifi.git#2.0.2 https://github.com/madpilot/mDNSResolver#4cfcda1 https://github.com/xoseperez/my92xx#3.0.1 - MQTT + https://github.com/256dpi/arduino-mqtt#196556b6 https://bitbucket.org/xoseperez/nofuss.git#0.3.0 https://github.com/xoseperez/NtpClient.git#0942ebc OneWire From d0c9b6d5eb0475eb6b5e0b6e9f712cf02e229bbb Mon Sep 17 00:00:00 2001 From: Maxim Prokhorov Date: Tue, 18 Feb 2020 09:52:44 +0300 Subject: [PATCH 2/2] mqtt: keepalive less than hb interval --- code/espurna/config/general.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index bb0851ee..b1856fc0 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -1029,7 +1029,7 @@ #endif #ifndef MQTT_KEEPALIVE -#define MQTT_KEEPALIVE 300 // MQTT keepalive value +#define MQTT_KEEPALIVE 120 // MQTT keepalive value #endif