Notifications don't work

Hello, I’m new to the community, I have a project with the pir sensor and the WEMOS D1mini, when using Blynk.notify I don’t receive any alerts on my device, I don’t know what I’m doing wrong, I appreciate any collaboration, greetings from Colombia, this is the code.

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "xxxx";
char ssid[] = "xxxxxx";
char pass[] = "xxxxx";

BlynkTimer timer;
int pinValue = 0;

#define PIR D3
#define relay1 D1

void setup() {
  Serial.begin(9600); 
  pinMode(D1, OUTPUT);
  digitalWrite(D3, LOW);
  digitalWrite (D1, LOW);
  delay(20000);
  

  Blynk.begin(auth, ssid, pass,"blynk.cloud", 80);
  timer.setInterval(1000L, notifiaction);

}
BLYNK_WRITE(V0) {
  pinValue = param.asInt();
}

void notifiaction() {
  bool sensor = digitalRead(D3);
  Serial.println(sensor);
  if (pinValue == 1) {
    Serial.println("System is ON");
    if (sensor == 1) { 
     Blynk.notify ("MOTION detect!!!");
      digitalWrite(D1, HIGH);
      delay(10000);
     
    } else if (sensor == 0) {
      digitalWrite(D1, LOW);
     delay(50);
    }
  } else if (pinValue == 0) {
    Serial.println("System is OFF");
  }
}

//Get buttons values
BLYNK_WRITE(V5) {
 bool RelayOne = param.asInt();
  if (RelayOne == 1) {
    digitalWrite(relay1, LOW);
  } else {
    digitalWrite(relay1, HIGH);
  }
}
void loop() {
  Blynk.run();
  timer.run();
}

Blynk.notify has been replaced with blynk.logevent

https://docs.blynk.io/en/getting-started/events-tutorial#use-blynk.logevent-firmware-api

1 Like

In addition, you need to remove the blocking delays from your code, and instead use timeout timers or flags to ensure that you don’t send notifications too often.

You should probably read this:

Pete.

2 Likes

Agradezco Su ayuda, Lo intentare, Gracias!

I appreciate your help, I’ll try it, thanks!