BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Home alarm security

Hello
I want your help with this plan.
First of all, let me introduce it to you, I use the board nodmcu
I have created 6 zones, an indication for activation-deactivation,
as well as a buzzer.
I control all this with the blynk application.
after I have added the following statements:
case1–alarm on
case2–alarm off
case3–alarm panic
case4–home mode
how can i add a RFID sensor to the program (on-off )
and if I can add a 15-second delay to the input door sensor
what other corrections, additions do you suggest?
thanks

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


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

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "@@@@@@@";

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

bool alarm_mode = false ;
bool sensorf = false  ;
int alarm_led = 4;
int sensor = 5;  //GPIO Pin number on which sensor is connected
int sensor_1 = 13;  //GPIO Pin number on which sensor is connected
int buzzer = 15; //GPIO Pin number on which buzzer is connecte
int pir_sensor = 14; //GPIO Pin number on which sensor is connected
int pir_sensor1 = 16; //GPIO Pin number on which sensor is connected
int pir_sensor2 = 12; //GPIO Pin number on which sensor is connected
int pir_sensor3 = 10;
BlynkTimer timer;

void myTimerEvent(){
  
    if(digitalRead(sensor) == 0){
    Blynk.virtualWrite(V0, "CLOSE");}

    if(digitalRead(sensor_1) == 0){
    Blynk.virtualWrite(V2, "CLOSE");}

   if(digitalRead(pir_sensor1) == 0){
    Blynk.virtualWrite(V3, "CLOSE");}

    if(digitalRead(pir_sensor2) == 0){
    Blynk.virtualWrite(V4, "CLOSE");}

   if(digitalRead(pir_sensor) == 0){
    Blynk.virtualWrite(V5, "CLOSE");}

    if(digitalRead(pir_sensor3) == 0){
    Blynk.virtualWrite(V6, "CLOSE");}
   
  
  if(digitalRead(sensor) == 1){
    Blynk.virtualWrite(V0, "OPEN");
    if(alarm_mode == true){
     Blynk.notify(" DOOR is open, Alarm Mode ON"); 
     digitalWrite(buzzer, HIGH); 
     }
     }       
      if(digitalRead(sensor_1) == 1){
    Blynk.virtualWrite(V2, "OPEN");
    if(alarm_mode == true){
      Blynk.notify("WINDOW is open,Alarm Mode ON");
      digitalWrite(buzzer,HIGH);
    }
    }

        if(digitalRead(pir_sensor1) == 1){
    Blynk.virtualWrite(V3, "OPEN");
    if(alarm_mode == true && sensorf == false){
      Blynk.notify("ALERT,radar apothikh is open,Alarm Mode ON");
      digitalWrite(buzzer,HIGH);
    }
    }

    if(digitalRead(pir_sensor3) == 1){
    Blynk.virtualWrite(V6, "OPEN");
    if(alarm_mode == true && sensorf == false){
      Blynk.notify("ALERT,RADAR @@@@@@ IS OPEN,ALARM MODE ON");
      digitalWrite(buzzer,HIGH);
    }
    }
    
       if(digitalRead(pir_sensor2) == 1){
   Blynk.virtualWrite(V4, "OPEN");
   if(alarm_mode == true && sensorf == false){
    Blynk.notify("ALERT,radar paidiko is open,Alarm Mode ON");
      digitalWrite(buzzer,HIGH);
    }
    }

       if(digitalRead(pir_sensor) == 1){
    Blynk.virtualWrite(V5, "OPEN");
    if(alarm_mode == true && sensorf == false){
      Blynk.notify("ALERT,radar saloni is open,Alarm Mode ON");
      digitalWrite(buzzer,HIGH);
    }
  }
  }

BLYNK_WRITE(V1) {
  switch (param.asInt()) {
    case 1: { // Item 1
      Serial.println("Item 1 selected");
      alarm_mode = true;
    sensorf = false;
  digitalWrite(alarm_led, HIGH); 
      break;
    }
    case 4: { // Item 4
      Serial.println("Item 4 selected");
      alarm_mode = true;
      sensorf =true;
      digitalWrite(sensor, HIGH); 
    digitalWrite(alarm_led, LOW); 
      break;
    }
    case 2: { // Item 2
      Serial.println("Item 2 selected");
      alarm_mode = false;
    sensorf = false;
   digitalWrite(buzzer, LOW);
      digitalWrite(alarm_led, LOW);  
      break;
    }
    case 3: { // Item 3
      Serial.println("Item 3 selected");
      alarm_mode = false;
    sensorf = false;
    digitalWrite(buzzer, HIGH);  
      digitalWrite(alarm_led, LOW);  
      break;
    }    
  }
}
BLYNK_CONNECTED() {
    Blynk.syncAll();
}
void setup()
{
  pinMode(sensor,INPUT_PULLUP);
  pinMode(buzzer,OUTPUT);
  pinMode(alarm_led,OUTPUT);
  pinMode(pir_sensor,INPUT_PULLUP);
  pinMode(sensor_1,INPUT_PULLUP);
  pinMode(pir_sensor1,INPUT_PULLUP);
  pinMode(pir_sensor2,INPUT_PULLUP);
  pinMode(pir_sensor3,INPUT_PULLUP);

  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
  
  // Setup a function to be called every second
  timer.setInterval(1000L, myTimerEvent);
  //timer.setInterval(500L, myTimerEvent);
 
}
void loop()
{
  Blynk.run();
  timer.run(); // Initiates BlynkTimer
}