Browse Source

Fix WiFiSecureClient connection for SSL when MQTT_USE_ASYNC=0

fastled
Xose Pérez 7 years ago
parent
commit
9411ddcf1f
3 changed files with 16 additions and 4 deletions
  1. +13
    -3
      code/espurna/config/general.h
  2. +2
    -0
      code/espurna/mqtt.ino
  3. +1
    -1
      code/platformio.ini

+ 13
- 3
code/espurna/config/general.h View File

@ -362,12 +362,21 @@ PROGMEM const char* const custom_reset_string[] = {
// Using MQTT over SSL works pretty well but generates problems with the web interface.
// It could be a good idea to use it in conjuntion with WEB_SUPPORT=0.
// Requires ASYNC_TCP_SSL_ENABLED to 1 and ESP8266 Arduino Core staging version.
// Right now only available when MQTT_USE_ASYNC=1 (default value).
//
// You can use it with MQTT_USE_ASYNC=1 (AsyncMqttClient library)
// but you might experience hiccups on the web interface, so my recommendation is:
// WEB_SUPPORT=0
//
// If you use it with MQTT_USE_ASYNC=0 (PubSubClient library)
// you will have to disable all the modules that use ESPAsyncTCP, that is:
// ALEXA_SUPPORT=0, INFLUXDB_SUPPORT=0, TELNET_SUPPORT=0 and WEB_SUPPORT=0
//
// You will need the fingerprint for your MQTT server, example for CloudMQTT:
// $ echo -n | openssl s_client -connect m11.cloudmqtt.com:24055 > cloudmqtt.pem
// $ openssl x509 -noout -in cloudmqtt.pem -fingerprint -sha1
#define MQTT_SSL_ENABLED 0
#define MQTT_SSL_FINGERPRINT ""
#define MQTT_SSL_ENABLED 0 // By default MQTT over SSL will not be enabled
#define MQTT_SSL_FINGERPRINT "" // SSL fingerprint of the server
#define MQTT_ENABLED 0 // Do not enable MQTT connection by default
#define MQTT_AUTOCONNECT 1 // If enabled and MDNS_SUPPORT=1 will perform an autodiscover and
@ -461,6 +470,7 @@ PROGMEM const char* const custom_reset_string[] = {
// LIGHT
// -----------------------------------------------------------------------------
// Available light providers (do not change)
#define LIGHT_PROVIDER_NONE 0
#define LIGHT_PROVIDER_MY9192 1
#define LIGHT_PROVIDER_DIMMER 2


+ 2
- 0
code/espurna/mqtt.ino View File

@ -393,6 +393,8 @@ void mqttConnect() {
DEBUG_MSG_P(PSTR("[MQTT] Invalid fingerprint\n"));
response = false;
}
_mqttClientSecure.stop();
yield();
} else {
DEBUG_MSG_P(PSTR("[MQTT] Wrong fingerprint\n"));
response = false;


+ 1
- 1
code/platformio.ini View File

@ -81,7 +81,7 @@ framework = arduino
board = nodemcuv2
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1 ${common.debug_flags}
build_flags = ${common.build_flags} -DNODEMCU_LOLIN -DDEBUG_FAUXMO=Serial -DNOWSAUTH -DASYNC_TCP_SSL_ENABLED=1
upload_speed = 460800
monitor_baud = 115200


Loading…
Cancel
Save