From 30154e23352faddbffbf8b9a75212970895cce8b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 8 Oct 2018 10:30:24 +0200 Subject: [PATCH] 6.2.1.13 Change to ArduinoMqtt 6.2.1.13 20181008 * Change default Mqtt client library from PubSubClient to non-blocking ArduinoMqtt by Joel Gaehwiler --- sonoff/_changelog.ino | 5 ++++- sonoff/sonoff.h | 5 +++-- sonoff/sonoff_version.h | 2 +- sonoff/user_config.h | 4 ++-- sonoff/xdrv_01_mqtt.ino | 23 +++++++++++++---------- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/sonoff/_changelog.ino b/sonoff/_changelog.ino index e04c9c727..2f3a38392 100644 --- a/sonoff/_changelog.ino +++ b/sonoff/_changelog.ino @@ -1,4 +1,7 @@ -/* 6.2.1.12 20181007 +/* 6.2.1.13 20181008 + * Change default Mqtt client library from PubSubClient to non-blocking ArduinoMqtt by Joel Gaehwiler + * + * 6.2.1.12 20181007 * Fix Shelly1 switchmode 3 and 4 when using pushbutton (#3989) * Add support for CSL Aplic WDP 303075 Power Socket with Energy Monitoring (#3991, #3996) * diff --git a/sonoff/sonoff.h b/sonoff/sonoff.h index 9a84fabd6..2e16b59b0 100644 --- a/sonoff/sonoff.h +++ b/sonoff/sonoff.h @@ -144,8 +144,9 @@ typedef unsigned long power_t; // Power (Relay) type #define NEO_GRBW 6 // Neopixel GRBW leds #define MQTT_PUBSUBCLIENT 1 // Mqtt PubSubClient library -#define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino -#define MQTT_ARDUINOMQTT 3 // Mqtt arduino-mqtt library by Joel Gaehwiler (https://github.com/256dpi/arduino-mqtt) +#define MQTT_TASMOTAMQTT 2 // Mqtt TasmotaMqtt library based on esp-mqtt-arduino - soon obsolete +#define MQTT_ESPMQTTARDUINO 3 // Mqtt esp-mqtt-arduino library by Ingo Randolf - obsolete +#define MQTT_ARDUINOMQTT 4 // Mqtt arduino-mqtt library by Joel Gaehwiler (https://github.com/256dpi/arduino-mqtt) // Sunrise and Sunset DawnType #define DAWN_NORMAL -0.8333 diff --git a/sonoff/sonoff_version.h b/sonoff/sonoff_version.h index df02100d3..eba7ddc21 100644 --- a/sonoff/sonoff_version.h +++ b/sonoff/sonoff_version.h @@ -20,7 +20,7 @@ #ifndef _SONOFF_VERSION_H_ #define _SONOFF_VERSION_H_ -#define VERSION 0x0602010C +#define VERSION 0x0602010D #define D_PROGRAMNAME "Sonoff-Tasmota" #define D_AUTHOR "Theo Arends" diff --git a/sonoff/user_config.h b/sonoff/user_config.h index 161b84fa1..0ed7eba35 100644 --- a/sonoff/user_config.h +++ b/sonoff/user_config.h @@ -220,11 +220,11 @@ * Select ONE of possible MQTT library types below \*-------------------------------------------------------------------------------------------*/ // Default MQTT driver for both non-TLS and TLS connections. Blocks network if MQTT server is unavailable. -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library +//#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library // Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support //#define MQTT_LIBRARY_TYPE MQTT_TASMOTAMQTT // Use TasmotaMqtt library (+4k4 (core 2.3.0), +14k4 (core 2.4.2 lwip2) code, +4k mem) - non-TLS only // Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested. -//#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem) +#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem) // -- MQTT ---------------------------------------- #define MQTT_TELE_RETAIN 0 // Tele messages may send retain flag (0 = off, 1 = on) diff --git a/sonoff/xdrv_01_mqtt.ino b/sonoff/xdrv_01_mqtt.ino index 3a7d16990..3cb76e86d 100644 --- a/sonoff/xdrv_01_mqtt.ino +++ b/sonoff/xdrv_01_mqtt.ino @@ -27,23 +27,26 @@ // Alternative MQTT driver does not block network when MQTT server is unavailable. TLS should work but needs to be tested. //#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Use arduino-mqtt (lwmqtt) library (+3k3 code, +2k mem) -#ifdef USE_MQTT_TLS +#if (MQTT_LIBRARY_TYPE == MQTT_ESPMQTTARDUINO) // Obsolete as of v6.2.1.11 +#undef MQTT_LIBRARY_TYPE +#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT +#endif /* -#ifdef MQTT_LIBRARY_TYPE -#undef MQTT_LIBRARY_TYPE -#endif -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS -*/ #if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) #undef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS +#define MQTT_LIBRARY_TYPE MQTT_ARDUINOMQTT // Obsolete in near future +#endif +*/ + +#ifdef USE_MQTT_TLS + +#if (MQTT_LIBRARY_TYPE == MQTT_TASMOTAMQTT) +#undef MQTT_LIBRARY_TYPE #endif -#else - #ifndef MQTT_LIBRARY_TYPE -#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as default +#define MQTT_LIBRARY_TYPE MQTT_PUBSUBCLIENT // Use PubSubClient library as it only supports TLS #endif #endif