Noise problems in switch

Hello. I need help with my project.
My project is about managing the lights in a room. I have a main light (220v), a 12V light and a strip of LEDs (12V).
Everything works perfectly, the only drawback is that the system disconnects. The Blynk APP connection is disconnected. I think I have detected the problem, it may be the physical switch that has noise and makes the system disconnect. I would like to know how to solve it. Thank you.

#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

#include <SoftwareSerial.h>


char auth[] = "xxxxxxxxxxxxxxxxxxx";
char ssid[] = "xxxxxxxxxxxxx";                         
char pass[] = "xxxxxxxxxxxx";              
             
int btnPin = D2;          
int RelayPin = D8;  
int LM = D3;
int apagado;      

BlynkTimer timer;
void checkPhysicalButton();
int btnPinState = LOW;           // ON
int RelayPinState = HIGH;

#define TURN_ON 0                 // TURN_ON and TURN_OFF are defined to account for Active High relays
#define TURN_OFF 1                // Used to switch relay states

void setup()
{
  Serial.begin (9600);
  Blynk.begin(auth, ssid, pass);
  pinMode(RelayPin, OUTPUT);            //  initialize your pin as output.
  pinMode(LM, OUTPUT);
  pinMode(btnPin, INPUT);        //  initialize your pin as input with enable internal pull-up resistor "input_pullup"
  digitalWrite(RelayPin, TURN_OFF);     // remain off till command is receive

  // Setup a function to be called every 100 ms
  timer.setInterval(100L, checkPhysicalButton);
  timer.setInterval(50L, prendido);

  apagado=0;
}

// Every time we connect to the cloud...
BLYNK_CONNECTED()
{
  // Request the latest state from the server
  Blynk.syncVirtual(V1);
}

// When App button is pushed - switch the state
// Map this Virtual Pin to your Mobile Blynk apps widget.
BLYNK_WRITE(V1)
{                           
  RelayPinState = param.asInt();
  digitalWrite(RelayPin, RelayPinState);
}

void checkPhysicalButton()
{
  digitalWrite(RelayPin, RelayPinState);

  if (digitalRead(btnPin) != btnPinState)          
  {
    Serial.println("HOLAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAS");
    digitalWrite(btnPin,btnPinState);
    btnPinState = !btnPinState; 

    if(RelayPinState == LOW)
    {

      digitalWrite(RelayPin,HIGH);
      Serial.println("CHAU");
      RelayPinState = HIGH;
      Blynk.virtualWrite(V1, RelayPinState);
    }

    else
    {
      digitalWrite(RelayPin,LOW);
      RelayPinState = LOW;
      Blynk.virtualWrite(V1, RelayPinState);
    }
  }
  
}

BLYNK_WRITE(V2)                 //lectura del botón virtual V2
{ 
  int pinValue = param.asInt();
  if (pinValue == 1) {
    digitalWrite(LM,HIGH);
  }
  else {
    digitalWrite(LM,LOW);
  }
}

BLYNK_WRITE(V3)                 //lectura del botón virtual V2
{ 
 int pinValue = param.asInt();
  if (pinValue == 1) {
    apagado=1;
  }
  else {
    apagado=0;
  } 
}

void prendido()
{
  if(apagado == 0)
  {
    digitalWrite(D5,LOW);
    digitalWrite(D6,LOW);
    digitalWrite(D7,LOW);
  }
}

void loop()
{
  Blynk.run();                               // Run Blynk
  timer.run();                               // Run SimpleTimer
}

This project is still in the testing phase. The Serial library will be removed when finished. The checkPhysicalButton () function is in charge of synchronizing the physical switch with the virtual one in the Blynk APP.
The prendido function is created so that when you want to use the led strip, you have to press a virtual switch in the APP.

Here is the connection diagram

I’m not a electronics master but I think you could add a 1 uF capacitor in parallel with the R1 resistor to filter the switch like in this video

By seeing your schematic I could tell you’ll have to change a little bit how your switch is connected

You appear to have ignored all of the comments I made here…

and you still haven’t provided any serial monitor data.

As you’ve created a new topic on basically the same issue, I’ve closed your old one.

Pete.