|
24 | 24 | #include "ESP8266WiFi.h" |
25 | 25 | #include "Wippersnapper.h" |
26 | 26 |
|
27 | | -static const char *fingerprint PROGMEM = |
28 | | - "59 3C 48 0A B1 8B 39 4E 0D 58 50 47 9A 13 55 60 CC A0 1D AF"; |
29 | | -static const char *fingerprint_staging PROGMEM = |
30 | | - "A0 A4 61 E0 D6 F8 94 FF FA C1 F2 DC 09 23 72 E1 " |
31 | | - "CC 23 CD 64"; ///< AIO Staging SSL Fingerprint |
| 27 | +/* NOTE - Projects that require "Secure MQTT" (TLS/SSL) also require a new |
| 28 | + * SSL certificate every year. If adding Secure MQTT to your ESP8266 project is |
| 29 | + * important - please switch to using the modern ESP32 (and related models) |
| 30 | + * instead of the ESP8266 to avoid updating the SSL fingerprint every year. |
| 31 | + * |
| 32 | + * If you've read through this and still want to use "Secure MQTT" with your |
| 33 | + * ESP8266 project, we've left the "WiFiClientSecure" lines commented out. To |
| 34 | + * use them, uncomment the commented out lines within this file and re-compile |
| 35 | + * the library. |
| 36 | + */ |
| 37 | +// static const char *fingerprint PROGMEM = "59 3C 48 0A B1 8B 39 4E 0D 58 50 47 |
| 38 | +// 9A 13 55 60 CC A0 1D AF"; static const char *fingerprint_staging PROGMEM = |
| 39 | +// "A0 A4 61 E0 D6 F8 94 FF FA C1 F2 DC 09 23 72 E1 CC 23 CD 64"; ///< AIO |
| 40 | +// Staging SSL Fingerprint |
32 | 41 |
|
33 | 42 | extern Wippersnapper WS; |
34 | 43 |
|
@@ -57,7 +66,7 @@ class Wippersnapper_ESP8266 : public Wippersnapper { |
57 | 66 | Wippersnapper_ESP8266() : Wippersnapper() { |
58 | 67 | _ssid = 0; |
59 | 68 | _pass = 0; |
60 | | - _wifi_client = new WiFiClientSecure; |
| 69 | + _wifi_client = new WiFiClient; |
61 | 70 | } |
62 | 71 |
|
63 | 72 | /**************************************************************************/ |
@@ -118,11 +127,14 @@ class Wippersnapper_ESP8266 : public Wippersnapper { |
118 | 127 | /*******************************************************************/ |
119 | 128 | void setupMQTTClient(const char *clientID) { |
120 | 129 | _mqttBrokerURL = "io.adafruit.com"; |
121 | | - _wifi_client->setFingerprint(fingerprint); |
122 | 130 |
|
123 | | - WS._mqtt = |
124 | | - new Adafruit_MQTT_Client(_wifi_client, _mqttBrokerURL, _mqtt_port, |
125 | | - clientID, WS._username, WS._key); |
| 131 | + // Uncomment the following lines to use MQTT/SSL. You will need to |
| 132 | + // re-compile after. _wifi_client->setFingerprint(fingerprint); WS._mqtt = |
| 133 | + // new Adafruit_MQTT_Client(_wifi_client, _mqttBrokerURL, _mqtt_port, |
| 134 | + // clientID, WS._username, WS._key); |
| 135 | + |
| 136 | + WS._mqtt = new Adafruit_MQTT_Client(_wifi_client, _mqttBrokerURL, 1883, |
| 137 | + clientID, WS._username, WS._key); |
126 | 138 | } |
127 | 139 |
|
128 | 140 | /********************************************************/ |
@@ -156,7 +168,7 @@ class Wippersnapper_ESP8266 : public Wippersnapper { |
156 | 168 | const char *_ssid = NULL; |
157 | 169 | const char *_pass = NULL; |
158 | 170 | const char *_mqttBrokerURL = NULL; |
159 | | - WiFiClientSecure *_wifi_client; |
| 171 | + WiFiClient *_wifi_client; |
160 | 172 |
|
161 | 173 | /**************************************************************************/ |
162 | 174 | /*! |
|
0 commit comments