Hi if I turn on my esp8266 and the level is lower than 30% I should receive a notification, but it is absolutely not displayed. As for the next notification, i.e. the one set at 12 hours is always working, why don’t I receive the first notification? where am i wrong? I also set to receive notifications every minute in the test phase but nothing to do.
#define BLYNK_TEMPLATE_ID "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME "Device"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
#define APP_DEBUG
#define USE_WEMOS_D1_MINI
#include "BlynkEdgent.h"
int Livello = 0 ;
byte flagACQ = 0 ;
int LivelloBassoCount = 0 ;
void setup() {
Serial.begin(115200);
BlynkEdgent.begin() ;
timer.setInterval( 1000L, LetturaLivello ) ;
}
void LetturaLivello(){
Livello = analogRead (A0);
Livello = map(Livello, valoremin, valoremax, 0, 100);
if (Livello <= 30 && flagACQ == 0 ) {
Blynk.logEvent ("livello_basso");
flagACQ = 1 ;}
if (Livello <= 30 && flagACQ == 1 && ++LivelloBassoCount == 43200 ) {//COUNT 12ore
Blynk.logEvent ("livello_basso");
flagACQ = 1 ; LivelloBassoCount = 0 ; }
if (Livello >= 50 ){flagACQ = 0; LivelloBassoCount = 0 ;}
}
void loop() {
BlynkEdgent.run();
timer.run();
}