Hello, I created a sketch to include email notifications if my temperature climbs above 60 degrees Fahrenheit. Once the temperature climbs above 60 I get my first notification. Then the notifications continue about 3 every minute and don’t stop even if the temperature has leveled off at lets say 74 degrees. Below I am including my sketch:
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>
#include <SimpleTimer.h>
#define DHTPIN D6
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;
float humidity, temp_f; // Values read from sensor
char auth[] = "e54a63f72f1b487b8fa1908fc0d*****"; //insert here your token generated by Blynk
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
delay(10);
Blynk.begin(auth, "H*****2-2.4", "**********"); //insert here your SSID and password
timer.setInterval(1000, sendData);
}
void sendData()
{
//Read the Temp and Humidity from DHT
float h = dht.readHumidity();
float t = dht.readTemperature(true);
//Write values to V04 and V05
Blynk.virtualWrite(4, h);
Blynk.virtualWrite(5, t);
if (t > 60){
Blynk.email("************@**************", "ALARM", "Temp is above 60F");
}
if (t < 40){
Blynk.email("************@**************", "ALARM", "Temp is below 40F");
}
}
void loop()
{
Blynk.run();
timer.run();
}