ESP8266 DHT11 Notification Support

Hello

When I receive a notification from the sensor, I want the next notification to come when the value in the sensor changes. If the notification came at 25 C, I want the next notification to come at 26 C. Can you help me?

// Comment this out to disable prints and save space
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// Your WiFi credentials.
// Set password to "" for open networks.
char auth[] = "";
char ssid[] = "";
char pass[] = "";

#define DHTPIN 4          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
 float nem = dht.readHumidity();
 float sicaklik = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

 if (isnan(nem) || isnan(sicaklik)) {
   Serial.println("Failed to read from DHT sensor!");
   return;
}
 // You can send any value at any time.
 // Please don't send more that 10 values per second.
 Blynk.virtualWrite(V1, nem);
 Blynk.virtualWrite(V0, sicaklik);

}
void sendAlert()
{
 float nem = dht.readHumidity();
 float sicaklik = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if(sicaklik > 26)
 {
   Blynk.notify(String("Sıcaklık Yüksek ")+sicaklik + String("°C"));
 }
 
 // You can send any value at any time.
 // Please don't send more that 10 values per second.
   Blynk.virtualWrite(V0, sicaklik);
}

void setup()
{
 // Debug console
 Serial.begin(115200);

 Blynk.begin(auth, ssid, pass);
 // You can also specify server:
 //Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
 //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

 dht.begin();

 // Setup a function to be called every second
 timer.setInterval(5000L, sendSensor);
 timer.setInterval(60000L, sendAlert);
}

void loop()
{
 Blynk.run();
 timer.run();
}

I’d suggest that you use a variable to store the value when you sent the last notification, then compare the latest reading with that value. If the latest reading If the latest reading is >= the last notified reading +1 then send a new notification and update the last notified value.

Pete.

Could you please post a sample code ?

I’m not going to write your code for you, because you won’t learn if I do.
Modify your code as I’ve suggested, and add-in some serial print statements to help you understand what is happening with your variable values.

If you still have problems then post your updated code and details of what your serial monitor is showing you.

Pete.