diff --git a/.github/workflows/githubci.yml b/.github/workflows/githubci.yml index 5c1a0e61..ab5e085c 100644 --- a/.github/workflows/githubci.yml +++ b/.github/workflows/githubci.yml @@ -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 }} diff --git a/README.md b/README.md index 80385841..58a25fc2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/library.properties b/library.properties index 395e234e..dd9877f7 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit IO Arduino -version=4.2.0 +version=4.2.1 author=Adafruit maintainer=Adafruit sentence=Arduino library to access Adafruit IO. diff --git a/src/AdafruitIO_Data.cpp b/src/AdafruitIO_Data.cpp index 208edcc7..53f4fa24 100644 --- a/src/AdafruitIO_Data.cpp +++ b/src/AdafruitIO_Data.cpp @@ -873,6 +873,7 @@ char **parse_csv(const char *line) { continue; case '\0': fEnd = 1; + continue; case ',': *tptr = '\0'; *bptr = strdup(tmp); diff --git a/src/AdafruitIO_Definitions.h b/src/AdafruitIO_Definitions.h index b1dfdf0e..dc2cb5e5 100644 --- a/src/AdafruitIO_Definitions.h +++ b/src/AdafruitIO_Definitions.h @@ -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; @@ -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 { diff --git a/src/wifi/AdafruitIO_ESP8266.cpp b/src/wifi/AdafruitIO_ESP8266.cpp index 3def7d28..ac3e2b19 100644 --- a/src/wifi/AdafruitIO_ESP8266.cpp +++ b/src/wifi/AdafruitIO_ESP8266.cpp @@ -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); } diff --git a/src/wifi/AdafruitIO_ESP8266.h b/src/wifi/AdafruitIO_ESP8266.h index c90ce8d1..e4be20af 100644 --- a/src/wifi/AdafruitIO_ESP8266.h +++ b/src/wifi/AdafruitIO_ESP8266.h @@ -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 { @@ -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