Skip to content

Commit

Permalink
Merge pull request #158 from brentru/remove-fingerprint-8266
Browse files Browse the repository at this point in the history
Remove SSL for ESP8266 Platform
  • Loading branch information
brentru authored Aug 10, 2022
2 parents f6d762f + 3aa5e68 commit a2b63fc
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 16 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ jobs:
run: bash ci/actions_install.sh


# manually install WiFi
# manually install WiFi and HTTPClient
- name: extra libraries
run: |
git clone --quiet https://github.com/adafruit/WiFiNINA.git /home/runner/Arduino/libraries/WiFiNINA
rm -rf /home/runner/Arduino/libraries/ArduinoHttpClient
git clone --quiet https://github.com/arduino-libraries/ArduinoHttpClient.git /home/runner/Arduino/libraries/ArduinoHttpClient
- name: test platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

![AIOArduino](https://cdn-learn.adafruit.com/assets/assets/000/057/496/original/adafruit_io_AIOA.png?1531335660)

This library provides a simple device independent interface for interacting with [Adafruit IO](https://io.adafruit.com) using Arduino. It allows you to switch between WiFi (ESP8266, ESP32, ESP32-S2, Airlift, WINC1500, & WICED), Cellular (32u4 FONA), and Ethernet (Ethernet FeatherWing).
This library provides a simple device independent interface for interacting with [Adafruit IO](https://io.adafruit.com) using Arduino. It allows you to switch between WiFi (ESP8266, ESP32, ESP32-S2, ESP32-S3, ESP32-C3, Airlift, WINC1500, & WICED), Cellular (32u4 FONA), and Ethernet (Ethernet FeatherWing).

## Documentation

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Adafruit IO Arduino
version=4.2.0
version=4.2.1
author=Adafruit
maintainer=Adafruit <[email protected]>
sentence=Arduino library to access Adafruit IO.
Expand Down
1 change: 1 addition & 0 deletions src/AdafruitIO_Data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ char **parse_csv(const char *line) {
continue;
case '\0':
fEnd = 1;
continue;
case ',':
*tptr = '\0';
*bptr = strdup(tmp);
Expand Down
16 changes: 8 additions & 8 deletions src/AdafruitIO_Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#ifndef ADAFRUITIO_DEFINITIONS_H_
#define ADAFRUITIO_DEFINITIONS_H_

#define ADAFRUITIO_VERSION_MAJOR 3 ///< Adafruit IO Arduino Major Semvar
#define ADAFRUITIO_VERSION_MINOR 5 ///< Adafruit IO Arduino Minor Semvar
#define ADAFRUITIO_VERSION_PATCH 0 ///< Adafruit IO Arduino Patch Semvar
#define ADAFRUITIO_VERSION_MAJOR 4 ///< Adafruit IO Arduino Major Semvar
#define ADAFRUITIO_VERSION_MINOR 2 ///< Adafruit IO Arduino Minor Semvar
#define ADAFRUITIO_VERSION_PATCH 1 ///< Adafruit IO Arduino Patch Semvar

// forward declaration
class AdafruitIO_Data;
Expand Down Expand Up @@ -125,14 +125,14 @@ class AdafruitIOGroupCallback {
///< Fingerprint

#define AIO_FEED_NAME_LENGTH \
258 ///< Maximum length of an Adafruit IO Feed \
///< Name; 128 + 1 + 128 for the group, a dot \
///< , and actual feed name.
258 ///< Maximum length of an Adafruit IO Feed: Name; 128 + 1 + 128 for the
///< group, a dot, and actual feed name.

#define AIO_DATA_LENGTH \
45 ///< Maximum length of data sent/recieved from Adafruit IO
#define AIO_CSV_LENGTH \
AIO_FEED_NAME_LENGTH + 4 ///< Maximum comma-separated-value length from \
///< Adafruit IO
AIO_FEED_NAME_LENGTH + \
4 ///< Maximum comma-separated-value length from Adafruit IO

/** aio_status_t offers 13 status states */
typedef enum {
Expand Down
10 changes: 7 additions & 3 deletions src/wifi/AdafruitIO_ESP8266.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char *user, const char *key,
: AdafruitIO(user, key) {
_ssid = ssid;
_pass = pass;
_client = new WiFiClientSecure;
_client->setFingerprint(AIO_SSL_FINGERPRINT);
_mqtt = new Adafruit_MQTT_Client(_client, _host, _mqtt_port);
// Uncomment the following lines and remove the existing WiFiClient and MQTT
// client constructors to use Secure MQTT with ESP8266.
// _client = new WiFiClientSecure;
// _client->setFingerprint(AIO_SSL_FINGERPRINT);
// _mqtt = new Adafruit_MQTT_Client(_client, _host, _mqtt_port);
_client = new WiFiClient;
_mqtt = new Adafruit_MQTT_Client(_client, _host, 1883);
_http = new HttpClient(*_client, _host, _http_port);
}

Expand Down
17 changes: 15 additions & 2 deletions src/wifi/AdafruitIO_ESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
#include "Adafruit_MQTT_Client.h"
#include "Arduino.h"
#include "ESP8266WiFi.h"
#include "WiFiClientSecure.h"
/* NOTE - Projects that require "Secure MQTT" (TLS/SSL) also require a new
* SSL certificate every year. If adding Secure MQTT to your ESP8266 project is
* important - please switch to using the modern ESP32 (and related models)
* instead of the ESP8266 to avoid updating the SSL fingerprint every year.
*
* If you've read through this and still want to use "Secure MQTT" with your
* ESP8266 project, we've left the "WiFiClientSecure" lines commented out. To
* use them, uncomment the commented out lines within `AdafruitIO_ESP8266.h` and
* `AdafruitIO_ESP8266.cpp` and recompile the library.
*/
// #include "WiFiClientSecure.h"

class AdafruitIO_ESP8266 : public AdafruitIO {

Expand All @@ -40,7 +50,10 @@ class AdafruitIO_ESP8266 : public AdafruitIO {

const char *_ssid;
const char *_pass;
WiFiClientSecure *_client;
WiFiClient *_client;
// Uncomment the following line, and remove the line above, to use
// secure MQTT with ESP8266.
// WiFiClientSecure *_client;
};

#endif // ESP8266
Expand Down

0 comments on commit a2b63fc

Please sign in to comment.