I am trying to move my sketches to the arduino editor, but I am getting some errors compiling that I don't understand. I assume the libraries that are eligible to download in the IDE desktop version are already included in the editor? Because I can't find a way to download them into IDE. I can add libraries that are not included within arduino interface to the editor, and I have for the code below.... But I am still getting errors compiling that appear to me to involve not having the libraries installed correctly within the arduino editor, but I am not sure.
Here is the code I am currently using:
#include <ESP_Mail_Client.h>
#include <ESP_Mail_FS.h>
#include <SDK_Version_Common.h>
#include <Arduino.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <ESP_Mail_Client.h>
#define SMTP_HOST "smtp.gmail.com"
#define SMTP_PORT 465
#define AUTHOR_EMAIL "emailchange"
#define AUTHOR_PASSWORD "wrongpassword"
#define RECIPIENT_EMAIL "addemail"
#define RECIPIENT_EMAIL2 "addemail2"
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
// Data wire is plugged into digital pin 2 on the Arduino
#define ONE_WIRE_BUS D3 // pin 8 on uno
// Setup a oneWire instance to communicate with any OneWire device
OneWire oneWire(ONE_WIRE_BUS);
// Pass oneWire reference to DallasTemperature library
DallasTemperature sensors(&oneWire);
// Set DHT pin:
#define DHTPIN 5 // pin 3 on uno
// Set DHT type, uncomment whatever type you're using!
//#define DHTTYPE DHT11 // DHT 11
#define DHTTYPE DHT22 // DHT 22 (AM2302)
//#define DHTTYPE DHT21 // DHT 21 (AM2301)
// Initialize DHT sensor for normal 16mhz Arduino:
DHT dht = DHT(DHTPIN, DHTTYPE);
const char* ssid = "SpectrumSetup-98";
const char* password = "wrongpassord";
String header;
String output5State = "off";
String output4State = "off";
WiFiServer server(80);
IPAddress ip(192, 168, 1, 166); // where xx is the desired IP Address
IPAddress gateway(192, 168, 1, 1); // set gateway to match your network
unsigned long currentMillis;
unsigned long previousMillis;
int checkNumber = 0;
unsigned long dehumidiferOnMillis;
unsigned long resetMillis = 0;
unsigned long checkMillis;
unsigned long startRunTime;
unsigned long runTime;
unsigned long totalRunTime = 0;
unsigned long checkDutyCycle = 3600000;// should return as 1 hour more than currentMillis each hour check function is called
unsigned long checkOneDayDuty = 0;
unsigned long fanOnlyMillis = 0;
unsigned long serialNow = 5000;
unsigned long previousTime = 0;
const long timeoutTime = 2000;
int minimumRunTime = 120000;// 2 min
int numberOfCyclesThisHour = 0;
int numberOfCyclesTotal = 0;
const unsigned long maxDutyCycle = 3600000;// 1 hour
const unsigned long delayPeriod = 300000;// 5 min delay period for fan to run after compressor cuts off also 3 min delay at start up and 5 minute delay between cycling compressor
const unsigned long serialDelay = 5000;
const int setH = 60;
const int setHighH = 63;
const int compressorRelay = D4;// pin 13 on uno
const int fanRelay = D5;//maybe pin 5 on uno
volatile boolean Running = false;
volatile boolean fanOnlyRunning = false;
volatile boolean Reset = false;
volatile boolean emailSent = false;
volatile boolean emailSent2 = false;
volatile boolean emailSent3 = false;
volatile boolean emailSent4 = false;
volatile boolean TestEmail = false;
volatile boolean SensorNotReadingB = false;
float halfDayRun;
/* The SMTP Session object used for Email sending */
SMTPSession smtp;
/* Callback function to get the Email sending status */
void smtpCallback(SMTP_Status status);
void setup() {
Serial.begin(115200);
sensors.begin(); // Start up the library for ds18b20 thermometer
dht.begin();
delay(10);
dehumidiferOnMillis = 0;
fanOnlyMillis = 0;
pinMode(fanRelay, OUTPUT);
pinMode(compressorRelay, OUTPUT);
digitalWrite(compressorRelay, HIGH); // OFF
digitalWrite(fanRelay, HIGH); // OFF
Serial.println("Starting, 5 minute wait before compressor will come on");
Serial.print(F("Setting static ip to : "));
Serial.println(ip);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
IPAddress subnet(255, 255, 255, 0); // set subnet mask to match your network
//WiFi.config(ip, gateway, subnet);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.print("Use this URL : ");
Serial.print("http://");
Serial.print(WiFi.localIP());
Serial.println("/");
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
// attempt to connect to WiFi network
Serial.println();
Serial.print("Connecting to WiFi...");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
// show WiFi status in serial monitor
Serial.println("");
Serial.println("WiFi connected.");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
ArduinoOTA.begin();
}
void loop() {
ArduinoOTA.handle();
currentMillis = millis();
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
sensorNotReading();// if sensor is not reading the compressor is turned off
return;
}
sensors.requestTemperatures(); //Getting Temperature of Compressor
float compressorTemp = ((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);
if (currentMillis - serialDelay > serialNow){
compressorTemp = ((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);
serialNow = currentMillis + serialDelay;
}
WiFiClient client = server.available(); // Listen for incoming clients
if (client) { // If a new client connects,
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
currentMillis = millis();
previousTime = currentMillis;
while (client.connected() && currentMillis - previousTime <= timeoutTime) { // loop while the client's connected
currentMillis = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// turns the GPIOs on and off
if (header.indexOf("GET /5/on") >= 0) {
Serial.println("GPIO 5 on");
output5State = "on";
// digitalWrite(output5, HIGH);
} else if (header.indexOf("GET /5/off") >= 0) {
Serial.println("GPIO 5 off");
output5State = "off";
//digitalWrite(output5, LOW);
} else if (header.indexOf("GET /4/on") >= 0) {
Serial.println("GPIO 4 on");
output4State = "on";
// digitalWrite(output4, HIGH);
} else if (header.indexOf("GET /4/off") >= 0) {
Serial.println("GPIO 4 off");
output4State = "off";
//digitalWrite(output4, LOW);
}
// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the on/off buttons
// Feel free to change the background-color and font-size attributes to fit your preferences
client.println("<style>html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}");
client.println(".button { background-color: #195B6A; border: none; color: white; padding: 16px 40px;");
client.println("text-decoration: none; font-size: 30px; margin: 2px; cursor: pointer;}");
client.println(".button2 {background-color: #77878A;}</style></head>");
// Web Page Heading
client.println("<body><h1>ESP8266 Web Server</h1>");
// Display current state, and ON/OFF buttons for GPIO 5
if (Running == true){
check();
client.println("<p>Dehumidifier is on " );
client.print("<p>humidity is: ");
client.println(h);
client.print("<p>compressor temperature is ");
client.println(compressorTemp);
client.print("<p>In the last hour, the compressor has been on ");
client.println(totalRunTime / 60000);
client.println("minutes out of the last ");
client.println((previousMillis - resetMillis) / 60000);
client.println("minutes.");
client.println("<p>In the last ");
client.println(checkNumber);
client.println("hour(s), the compressor has been on ");
client.println(halfDayRun / 3600000);
client.println("hours");
client.println("<p>The number of times the compressor has turned on this hours is ");
client.println(numberOfCyclesThisHour);
client.println("<p>In the last ");
client.println(checkNumber);
client.println("hour(s), the compressor has cycled on ");
client.println(numberOfCyclesTotal);
client.println("<p>The dehumidifier is set to come on when the humidity is above ");
client.println(setHighH);
client.println("<p>The dehumidifier is set to go off when the humidity gets below ");
client.println(setH);
}
else{
check();
client.println("<p>Dehumidifier is off " );
client.print("<P>humidity is: ");
client.println(h);
client.print("<p>compressor temperature is ");
client.println(compressorTemp);
client.print("<p>In the last hour, the compressor has been on ");
client.println(totalRunTime / 60000);
client.println("minutes out of the last ");
client.println((previousMillis - resetMillis ) / 60000);
client.println("minutes.");
client.println("<p>In the last ");
client.println(checkNumber);
client.println("hour(s), the compressor has been on ");
client.println(halfDayRun / 3600000);
client.println("hours");
client.println("<p>The number of times the compressor has turned on this hours is ");
client.println(numberOfCyclesThisHour);
client.println("<p>In the last ");
client.println(checkNumber);
client.println("hour(s), the compressor has cycled on ");
client.println(numberOfCyclesTotal);
client.println("<p>The dehumidifier is set to come on when the humidity is above ");
client.println(setHighH);
client.println("<p>The dehumidifier is set to go off when the humidity gets below ");
client.println(setH);
}
if (fanOnlyRunning == true){
client.print("<p>Compressor is off: Fan is on");
}
// If the output5State is off, it displays the ON button
//if (output5State=="off") {
//client.println("<p><a href=\"/5/on\"><button class=\"button\">ON</button></a></p>");
//} else {
//client.println("<p><a href=\"/5/off\"><button class=\"button button2\">OFF</button></a></p>");
//}
// Display current state, and ON/OFF buttons for GPIO 4
//client.println("<p>GPIO 4 - State " + output4State + "</p>");
// If the output4State is off, it displays the ON button
//if (output4State=="off") {
//client.println("<p><a href=\"/4/on\"><button class=\"button\">ON</button></a></p>");
//} else {
//client.println("<p><a href=\"/4/off\"><button class=\"button button2\">OFF</button></a></p>");
//}
//client.println("</body></html>");
// The HTTP response ends with another blank line
client.println();
// Break out of the while loop
break;
} else { // if you got a newline, then clear currentLine
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Clear the header variable
header = "";
// Close the connection
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
}
if (halfDayRun >= 3600000 * 12 and emailSent4 == false){
email4();
}
//if (currentMillis >= 38000 and TestEmail == false){
// Testemail1();
// }
if (h > setHighH + 3 and emailSent3 == false) {
email3();
}
if (numberOfCyclesThisHour > 3 and emailSent2 == false){
email2();
}
if (compressorTemp >= 130 and emailSent == false) {
email();
}
if (compressorTemp >= 150) {
shutDown();
}
if (h > setHighH and currentMillis > delayPeriod and Running == false and Reset == false) {
dehumidifierOn();
}
if (h < setH and fanOnlyRunning == false and Running == true and currentMillis >= minimumRunTime + dehumidiferOnMillis) {
fanOnly();
}
if (currentMillis - delayPeriod / 2 > fanOnlyMillis and Running == false and fanOnlyRunning == true) {
dehumidifierOff();
}
if (currentMillis >= (checkDutyCycle)) {
reset();
}
if (currentMillis >= (checkOneDayDuty)){
resetHalfDay();
}
}
void dehumidifierOn()
{
if (currentMillis - delayPeriod > fanOnlyMillis) {
digitalWrite(compressorRelay, LOW); // Compressor ON
digitalWrite(fanRelay, LOW); // Compressor ON
dehumidiferOnMillis = currentMillis;
startRunTime = currentMillis;
Running = true;
fanOnlyRunning = false;
numberOfCyclesThisHour = numberOfCyclesThisHour + 1;
}
}
void fanOnly()
{
digitalWrite(compressorRelay, HIGH); // Compressor OFF
fanOnlyMillis = currentMillis;
Running = false;
fanOnlyRunning = true;
runTime = currentMillis;
totalRunTime = runTime - startRunTime + totalRunTime;
}
void dehumidifierOff()
{
digitalWrite(compressorRelay, HIGH); // Compressor OFF
digitalWrite(fanRelay, HIGH);// fan OFF
fanOnlyRunning = false;
Reset = false;
}
void sensorNotReading()
{
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
secondAttempt();
}
else {
loop();
}
}
void secondAttempt()
{
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
thirdAttempt();
}
else {
loop();
}
}
void thirdAttempt()
{
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
sensorNotReadingEmail();
dehumidifierOff();
}
else {
loop();
}
}
void reset()
{
numberOfCyclesTotal = numberOfCyclesTotal + numberOfCyclesThisHour;
numberOfCyclesThisHour = 0;
runTime = 0;
halfDayRun = totalRunTime + halfDayRun;
totalRunTime = 0;
checkDutyCycle = (currentMillis + maxDutyCycle);
resetMillis = currentMillis;
checkNumber = checkNumber + 1 ;
emailSent = false;
emailSent2 = false;
emailSent3 = false;
SensorNotReadingB = false;
if (Running == true){
numberOfCyclesThisHour = 1;
startRunTime = currentMillis;
}
}
void check()
{
if (Running == true){
runTime = currentMillis;
totalRunTime = runTime - startRunTime + totalRunTime;
startRunTime = currentMillis;
previousMillis = currentMillis;
}
else{
totalRunTime = totalRunTime;
previousMillis = currentMillis;
}
}
void shutDown()
{
emailShutDown();
while (1) {
delay(10000);
}
}
void resetHalfDay()
{
checkOneDayDuty = currentMillis + 86400000; // 86400000 is 1 day in milliseconds should reset each day
halfDayRun = 0;
checkNumber = 0;
numberOfCyclesTotal = 0;
emailSent4 = false;
}
/* Callback function to get the Email sending status */
void smtpCallback(SMTP_Status status){
/* Print the current status */
Serial.println(status.info());
/* Print the sending result */
if (status.success()){
Serial.println("----------------");
ESP_MAIL_PRINTF("Message sent success: %d\n", status.completedCount());
ESP_MAIL_PRINTF("Message sent failled: %d\n", status.failedCount());
Serial.println("----------------\n");
struct tm dt;
for (size_t i = 0; i < smtp.sendingResult.size(); i++){
/* Get the result item */
SMTP_Result result = smtp.sendingResult.getItem(i);
time_t ts = (time_t)result.timestamp;
localtime_r(&ts, &dt);
ESP_MAIL_PRINTF("Message No: %d\n", i + 1);
ESP_MAIL_PRINTF("Status: %s\n", result.completed ? "success" : "failed");
ESP_MAIL_PRINTF("Date/Time: %d/%d/%d %d:%d:%d\n", dt.tm_year + 1900, dt.tm_mon + 1, dt.tm_mday, dt.tm_hour, dt.tm_min, dt.tm_sec);
ESP_MAIL_PRINTF("Recipient: %s\n", result.recipients);
ESP_MAIL_PRINTF("Subject: %s\n", result.subject);
}
Serial.println("----------------\n");
}
}
void email ()
{
/** Enable the debug via Serial port
* none debug or 0
* basic debug or 1
*/
smtp.debug(1);
/* Set the callback function to get the sending results */
smtp.callback(smtpCallback);
/* Declare the session config data */
ESP_Mail_Session session;
/* Set the session config */
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
/* Declare the message class */
SMTP_Message message;
/* Set the message headers */
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Compresser temp warning";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
/*Send HTML message*/
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>Compressor temperature Is above 130 degrees</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
/* Set the custom message header */
//message.addHeader("Message-ID: <abcde.fghij@gmail.com>");
/* Connect to server with the session config */
if (!smtp.connect(&session))
return;
/* Start sending Email and close the session */
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
emailSent = true;
}
void email2 ()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Compresser cycle warning";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>Compressor has cycled on more than 3 times this hour </h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
emailSent2 = true;
}
void email3()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Humidity too high";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>Dehumidifier is not keeping the humidity below the desired amount</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
emailSent3 = true;
}
void email4()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Dehumidifier Run Time";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>The compressor has been running more than 12 hours in a 24 hour period.</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
emailSent4 = true;
}
void emailShutDown()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Dehumidifier ShutDown!";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>Compresser Temp is above 150. It has shut down. Need to check.</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
}
void Testemail1()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Email Test";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>Did you get this email?</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
TestEmail = true;
}
void sensorNotReadingEmail()
{
smtp.debug(1);
smtp.callback(smtpCallback);
ESP_Mail_Session session;
session.server.host_name = SMTP_HOST;
session.server.port = SMTP_PORT;
session.login.email = AUTHOR_EMAIL;
session.login.password = AUTHOR_PASSWORD;
session.login.user_domain = "";
SMTP_Message message;
message.sender.name = "Dehumidifier Message";
message.sender.email = AUTHOR_EMAIL;
message.subject = "Humidity Sensor Not Reading";
message.addRecipient("Nick", RECIPIENT_EMAIL);
message.addRecipient("Daddy", RECIPIENT_EMAIL2);
String htmlMsg = "<div style=\"color:#2f4468;\"><h1>The humidity sensor has not been read in the last three tries. Needs checking:</h1><p>- Sent from ESP board</p></div>";
message.html.content = htmlMsg.c_str();
message.html.content = htmlMsg.c_str();
message.text.charSet = "us-ascii";
message.html.transfer_encoding = Content_Transfer_Encoding::enc_7bit;
if (!smtp.connect(&session))
return;
if (!MailClient.sendMail(&smtp, &message))
Serial.println("Error sending Email, " + smtp.errorReason());
SensorNotReadingB = true;
}
It will compile fine with the desktop version of the arduino ide.... just not the online editor.
Here is the error:
/usr/local/bin/arduino-cli compile --fqbn esp8266:esp8266:d1_mini:baud=921600,dbg=Disabled,eesz=4M,exception=disabled,ip=lm2f,lvl=None____,vt=flash,wipe=none,xtal=80 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/374190154/build --build-path /tmp/arduino-build-100602E7E8C267C0DABCEB7CB1BEC584 --library /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client --library /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/RTClib /tmp/374190154/10_12_current_code
Using library ArduinoOTA at version 1.0 in folder: /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/ArduinoOTA
Using library ESP8266mDNS at version 1.2 in folder: /home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/ESP8266mDNS
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp: In member function 'bool ESP_Mail_Client::openFileRead(SMTPSession*, SMTP_Message*, SMTP_Attachment*, File&, std::string&, std::string&, const string&, bool)':
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:2995:12: error: no match for 'operator=' (operand types are 'File' and 'fs::File')
file = ESP_MAIL_FLASH_FS.open(filepath.c_str(), "r");
^
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:2995:12: note: candidates are:
In file included from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.h:59:0,
from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:43:
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(const File&)
class File : public Stream {
^
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'const File&'
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(File&&)
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'File&&'
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp: In member function 'bool ESP_Mail_Client::openFileRead2(SMTPSession*, SMTP_Message*, File&, const char*, esp_mail_file_storage_type)':
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:3065:12: error: no match for 'operator=' (operand types are 'File' and 'fs::File')
file = ESP_MAIL_FLASH_FS.open(filepath.c_str(), "r");
^
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:3065:12: note: candidates are:
In file included from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.h:59:0,
from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:43:
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(const File&)
class File : public Stream {
^
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'const File&'
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(File&&)
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'File&&'
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp: In member function 'void ESP_Mail_Client::saveHeader(IMAPSession*)':
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:6308:12: error: no match for 'operator=' (operand types are 'File' and 'fs::File')
file = ESP_MAIL_FLASH_FS.open(headerFilePath.c_str(), "w");
^
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:6308:12: note: candidates are:
In file included from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.h:59:0,
from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:43:
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(const File&)
class File : public Stream {
^
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'const File&'
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(File&&)
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'File&&'
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp: In member function 'bool ESP_Mail_Client::handleAttachment(IMAPSession*, char*, int, int&, File&, std::string&, bool&, int&, int&, int&, int&, int&)':
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:6638:14: error: no match for 'operator=' (operand types are 'File' and 'fs::File')
file = ESP_MAIL_FLASH_FS.open(filePath.c_str(), "w");
^
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:6638:14: note: candidates are:
In file included from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.h:59:0,
from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:43:
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(const File&)
class File : public Stream {
^
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'const File&'
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(File&&)
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'File&&'
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp: In member function 'void ESP_Mail_Client::decodeText(IMAPSession*, char*, int, int&, File&, std::string&, bool&, int&, int&, int&)':
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:7046:22: error: no match for 'operator=' (operand types are 'File' and 'fs::File')
file = ESP_MAIL_FLASH_FS.open(filePath.c_str(), "w");
^
/mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:7046:22: note: candidates are:
In file included from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.h:59:0,
from /mnt/create-efs/webide/78/b6/78b6874e2766049830514ce3b420c195:neketege88/libraries_v2/ESP Mail Client/src/ESP_Mail_Client.cpp:43:
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(const File&)
class File : public Stream {
^
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'const File&'
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: File& File::operator=(File&&)
/home/builder/.arduino15/packages/esp8266/hardware/esp8266/2.5.0/libraries/SD/src/SD.h:26:7: note: no known conversion for argument 1 from 'fs::File' to 'File&&'
Error during build: exit status 1
Thanks for any help!