Going through the link above @PaulRB - I've made a basic test file before incorporating into my existing UV sensor code.
This is the test code (a copy and paste of the HTTPS Requests link you've sent):
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>
// Replace with your network credentials
const char* ssid = "removed";
const char* password = "removed";
void setup() {
Serial.begin(115200);
//Serial.setDebugOutput(true);
Serial.println();
Serial.println();
Serial.println();
//Connect to Wi-Fi
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
Serial.print("Connecting to WiFi ..");
while (WiFi.status() != WL_CONNECTED) {
Serial.print('.');
delay(1000);
}
}
void loop() {
// wait for WiFi connection
if ((WiFi.status() == WL_CONNECTED)) {
std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
// Ignore SSL certificate validation
client->setInsecure();
//create an HTTPClient instance
HTTPClient https;
//Initializing an HTTPS communication using the secure client
Serial.print("[HTTPS] begin...\n");
if (https.begin(*client, "https://www.howsmyssl.com/a/check")) { // HTTPS
Serial.print("[HTTPS] GET...\n");
// start connection and send HTTP header
int httpCode = https.GET();
// httpCode will be negative on error
if (httpCode > 0) {
// HTTP header has been send and Server response header has been handled
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
// file found at server
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
String payload = https.getString();
Serial.println(payload);
}
} else {
Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
}
https.end();
} else {
Serial.printf("[HTTPS] Unable to connect\n");
}
}
Serial.println();
Serial.println("Waiting 2min before the next round...");
delay(120000);
}
When compiling, I get this error:
UV_2023:4:37: fatal error: WiFiClientSecureBearSSL.h: No such file or directory
#include <WiFiClientSecureBearSSL.h>
^
compilation terminated.
exit status 1
WiFiClientSecureBearSSL.h: No such file or directory
Fair enough.
I can't find the WiFiClientSecureBearSSL library when searching in Library Manager.
Any idea how I can install it via a .zip file or whatever? Thanks.


