[SOLVED] Problems with sketch`s work in rainy weather

Good decision. But in my event I must add antenna to my network provider`s equipment on a roof of my house)) So I’ll chop the provider to improve the quality of connection and just in case make sketch more lighter.

That would be the first place to start, yup :slight_smile:

There can be a done a lot in the software (coding skills :slight_smile: ). I think you can even boost the signal from the Wemos with some parameters.

What you have to remember when dealing with Wifi, it’s still a two-way medium. So if you have a VERY good sender (router or something) but your receiving equipment is lousy, e.g. bad or small antenna’s and such, you still get a crappy connection. Lots of people think buying a very expensive, big router is the solution, but it’s not. In most cases (laptops, phones etc.) you need to ensure good quality hardware too in the form of decent network cards, good software (drivers mostly) and good antenna’s.

1 Like

@Pacer, Take a look at a few of my projects, in particular one that relies heavily on carefully timed timers (as to not crash the little ESP).

1 Like

aahh… you added one more timer piece- set timeout… Looks like cyclic timers are executed sequentially and do not overlap each other

1 Like

You got it mate… sequenced timers over 1 second… spilit at 200ms intervals. It’s the best way to maximise your ESP without putting too much on its plate.

Also take note of the short format used. This way you dont have to set up another callback function!

timer.setTimeout(2000,[](){
  // perform functions here
}):

instead of

timer.setTimeout(2000,callback);
void callback(){
  // perform functions here
}

Its not a very well documented method… but you can thank @Gunner for discovering it :smiley:

3 Likes

Yes, it can be useful for me. Thanks for this.
By the way, the weather is rainy now again but the connection is perfect.
I think it was technical troubles on one of the nodes on the way to the blynk server.

Hello all!
Fresh news!
I upgraded the sketch with splittimers, picked up all content from Void loop(), exept timer.run & Blynk.run, threw away all of delay (); and Blynk.syncALL.

This D1 mini controls autolight in two rooms with IR (PIR) sensors and photoresistor. Earlier I wrote about the problem of unexpected switching-on.
But now autolight sometimes switch-on in other room with the following algorithm:

Sometimes once every 30-40 minutes and sometimes once in one-two hours the light turns on without a reason and does not turn off according to the timer in the code, until I create a movement near the IR sensors, in which case the timer starts to swicht off the light. Then everything repeats itself.

The sketch have Notify Widget that sends to the app notification about the triggering of each of the IR sensors. To my surprise notifications of the operation do not come and the LED widget also remains silent when the light starts suddenly turn on.

Please, help to fix this.

Here is the upgraded sketch:

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

#define DHTPIN 4
#define DHTTYPE DHT11 



long unsigned int lowIn; 
long unsigned int pause = 30000;
bool lockLow = true;
bool takeLowTime;




long unsigned int lowIn2; 
long unsigned int pause2 = 30000;
bool lockLow2 = true;
bool takeLowTime2;

bool needlightstate= false;







const int doorprihoj = 14; 
const int pirprihoj = 12;    
const int pir2prihoj = 16;
const int releprihoj = 3;   

const int pir1kuh = 2;
const int pir2kuh = 0;
const int lightkuh = 5;
const int relekuh = 1;


WidgetBridge bridge1(V8);

int timer1;
int timer2;
int timer3;
int timer4;
int nointernettimer;
int timer5;

int splittimer1;
int splittimer2;


int autoprihoj =0;
int autokuh=0;
int ohrana=0;


char auth[] = "AAAAAAA";

char ssid[] = "BBBBBBB";
char pass[] = "CCCCCC";


SimpleTimer timer;
DHT dht(DHTPIN, DHTTYPE);



 
  

void sendUptime()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  t = ((int) (t * 10) / 10.0);
  h = ((int) (h * 10) / 10.0);
  
  Blynk.virtualWrite(8, t); 
  Blynk.virtualWrite(9, h); 
  bridge1.virtualWrite (V26, t);

  

}


void autolightprihoj()     // THE LAWLESSNESS NOW BEGINS HERE
{

if (autoprihoj==0)
  { 




   
 int door=digitalRead(doorprihoj);
  
  
  if(digitalRead(pirprihoj)==HIGH||door==0||digitalRead(pir2prihoj)==HIGH)
  {
    
    if(lockLow)
    {
      lockLow = false;     
      
      digitalWrite(3, LOW);
      Blynk.virtualWrite (V0, LOW);
      
    }        
    takeLowTime = true;
  }

  
  if(digitalRead(pirprihoj)==LOW&&door==1&&digitalRead(pir2prihoj)==LOW)
  {      
    
    if(takeLowTime)
    {
      lowIn = millis();          
      takeLowTime = false;       
    }
   
    if(!lockLow && millis() - lowIn > pause)
    { 
     
      lockLow = true;               
      
      digitalWrite (3, HIGH);
      Blynk.virtualWrite (V0, HIGH);
      
    }

  }
    
       
  }}

void autolightkuh ()
{
 if (autokuh==0)
  { bool needlight= (digitalRead(lightkuh)==HIGH&&digitalRead(pir1kuh)==HIGH)||(digitalRead(lightkuh)==HIGH&&digitalRead(pir2kuh)==HIGH);
    if (needlight)
     {digitalWrite(1, LOW);
      needlightstate = true;

      Blynk.virtualWrite (V3, LOW);
     }
  

      if (needlightstate==true){
    
    if (digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {
    
    if(lockLow2)
    {
      lockLow2 = false;     
      
      digitalWrite(1, LOW);
      Blynk.virtualWrite (V3, LOW);
    }        
    takeLowTime2 = true;
  }

  
  if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {      
    
    if(takeLowTime2)
    {
      lowIn2 = millis();         
      takeLowTime2 = false;       
    }
    
    if(!lockLow2 &&( millis() - lowIn2 > pause2))
    { 
      
      lockLow2 = true;               
      
     
      digitalWrite (1, HIGH);
      Blynk.virtualWrite (V3, HIGH);
      
      needlightstate= false;
    
     }
   
    }}
   
    
    }
  
}

 
 




BLYNK_CONNECTED() {
  
 bridge1.setAuthToken("DDDDDDDDDDD");
 
}


 


void sendnotify ()
{ 
  if (ohrana==0){
  Blynk.virtualWrite (V11, 0);
   if(digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {
  Blynk.virtualWrite (V10, 255);}

 if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {Blynk.virtualWrite (V10, 0);}
  
  
  if (digitalRead(doorprihoj)==0)
 {
   Blynk.virtualWrite (V4, 255);}

if (digitalRead(doorprihoj)==1)
 { 
   Blynk.virtualWrite (V4, 0);}
  
   if(digitalRead(pirprihoj)==HIGH||digitalRead(pir2prihoj)==HIGH)
  { 
   
  Blynk.virtualWrite (V7, 255);}
  
  if(digitalRead(pirprihoj)==LOW&&digitalRead(pir2prihoj)==LOW)
  {Blynk.virtualWrite (V7, 0); 
      }}     
      
   if (ohrana==1){
  Blynk.virtualWrite (V11, 255);
   if(digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {Blynk.notify ("Движение на кухне");
  Blynk.virtualWrite (V10, 255);}

 if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {Blynk.virtualWrite (V10, 0);}
  
  
  if (digitalRead(doorprihoj)==0)
 {Blynk.notify ("Входная Дверь открыта"); 
   Blynk.virtualWrite (V4, 255);}

if (digitalRead(doorprihoj)==1)
 {
   Blynk.virtualWrite (V4, 0);}
  
   if(digitalRead(pirprihoj)==HIGH||digitalRead(pir2prihoj)==HIGH)
  { 
  Blynk.notify ("Движение в прихожей"); 
  Blynk.virtualWrite (V7, 255);}
  
  if(digitalRead(pirprihoj)==LOW&&digitalRead(pir2prihoj)==LOW)
  {Blynk.virtualWrite (V7, 0); 
      }}   
      
      }

  
void setup()
{
  
  
  splittimer1 = timer.setTimeout(500, []() {
  timer4= timer.setInterval (1000, autolightkuh);
  });

  splittimer2 = timer.setTimeout(500, []() {
  timer3= timer.setInterval (1000, autolightprihoj);
  });
  
  timer2= timer.setInterval(6300, sendnotify);
  timer1= timer.setInterval(10000, sendUptime);
  
  
 
  pinMode (pirprihoj,INPUT);    
  pinMode (pir2prihoj,INPUT); 
  pinMode (releprihoj,OUTPUT);   
  pinMode (doorprihoj,INPUT);
  pinMode (pir1kuh,INPUT);
  pinMode (pir2kuh,INPUT);
  pinMode (lightkuh,INPUT);
  pinMode (relekuh,OUTPUT);
  dht.begin();
  digitalWrite (releprihoj, HIGH);
  digitalWrite (relekuh, HIGH);
  Blynk.begin(auth, ssid, pass);
}


 BLYNK_WRITE(V0) 
  {if(param.asInt()==0)
{ if (autoprihoj==1) {digitalWrite(releprihoj, LOW);}
if (autoprihoj==0) {
 if (digitalRead (releprihoj)==LOW)
 {Blynk.virtualWrite (V0, LOW);}
 if (digitalRead (releprihoj)==HIGH)
 {Blynk.virtualWrite (V0, HIGH);}}}
  
else { if (autoprihoj==1) {digitalWrite(releprihoj, HIGH);}
if (autoprihoj==0) {
 if (digitalRead (releprihoj)==LOW)
 {Blynk.virtualWrite (V0, LOW);}
 if (digitalRead (releprihoj)==HIGH)
 {Blynk.virtualWrite (V0, HIGH);}}}}

 
 
 





 BLYNK_WRITE(V3) 
  {if(param.asInt()==0)
{ if (autokuh==1) {digitalWrite(relekuh, LOW);}
if (autokuh==0) {
 if (digitalRead (relekuh)==LOW)
 {Blynk.virtualWrite (V3, LOW);}
 if (digitalRead (relekuh)==HIGH)
 {Blynk.virtualWrite (V3, HIGH);}}}
  
else { if (autokuh==1) {digitalWrite(relekuh, HIGH);}
if (autokuh==0) {
 if (digitalRead (relekuh)==LOW)
 {Blynk.virtualWrite (V3, LOW);}
 if (digitalRead (relekuh)==HIGH)
 {Blynk.virtualWrite (V3, HIGH);}}}}

  BLYNK_WRITE(V1) 
 {if(param.asInt()==0)
{ autoprihoj=0;
  }
else {autoprihoj=1;}}

BLYNK_WRITE(V12) 
 {switch(param.asInt())

{case 1: { autokuh=1; break;}
 case 2: { autokuh=0; pause2= 10000; break;}
 case 3: { autokuh=0; pause2= 30000; break;}
 case 4: { autokuh=0; pause2= 60000; break;}
 case 5: {autokuh=0; pause2= 150000; break;}
 case 6: {autokuh=0; pause2=180000; break;}
 }}


BLYNK_WRITE(V17)
 {if(param.asInt()==0)
 {ohrana=1;

 Blynk.notify ("ОХРАНА АКТИВИРОВАНА"); 
 Blynk.virtualWrite (V11, 255);}

 
 else {ohrana=0;

 Blynk.notify ("ОХРАНА ОТКЛЮЧЕНА");
 Blynk.virtualWrite (V11, 0);}}




void loop()
{

   Blynk.run();
  timer.run();
}
1 Like

Are you saying that you have a single Wemos D1 Mini with two PIR detectors attached to it, one in the same room as the Wemos and the other some distance away?
If so, how long is the wire from the PIR in the other room and what type of wire are you using to connect the Wemos? Is the wire screened and if so what is the screening wire connected to?

As far as asking people to review your code, it would help if you added enough comments so that people could figure-out which PIR is the one causing the problem. In fact, the more comments the better!

Pete.

Generally, there is four PIR sensors-two in one room and two in other. Earlier this problem was in one of the room, now when I rebuilding sketch the problem moves to other room, so this is not a technical cause with wires and it’s screening. I think most likely the rooms changed places with a change in the order of calling the functions corresponding to them in the sketch. But I answer your question-
wire lengh from D1 to PIRs from other room is about 2 meters (paved through the wall network cables).
I leave the comment when the problem starts now. More comments added. Please see this.

#include <SimpleTimer.h>
#include <DHT.h>

#define DHTPIN 4
#define DHTTYPE DHT11 



long unsigned int lowIn; 
long unsigned int pause = 30000;
bool lockLow = true;
bool takeLowTime;




long unsigned int lowIn2; 
long unsigned int pause2 = 30000;
bool lockLow2 = true;
bool takeLowTime2;

bool needlightstate= false;







const int doorprihoj = 14; 
const int pirprihoj = 12;    \\\problem PIR1
const int pir2prihoj = 16;  \\\problem PIR2
const int releprihoj = 3;   \\\relay that unexpected turns on and not off.

const int pir1kuh = 2;
const int pir2kuh = 0;
const int lightkuh = 5;
const int relekuh = 1;


WidgetBridge bridge1(V8);

int timer1;
int timer2;
int timer3;
int timer4;
int timer5;

int splittimer1;
int splittimer2;


int autoprihoj =0;
int autokuh=0;
int ohrana=0;


char auth[] = "AAAAAAA";

char ssid[] = "BBBBBBB";
char pass[] = "CCCCCC";


SimpleTimer timer;
DHT dht(DHTPIN, DHTTYPE);



 
  

void sendUptime()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  t = ((int) (t * 10) / 10.0);
  h = ((int) (h * 10) / 10.0);
  
  Blynk.virtualWrite(8, t); 
  Blynk.virtualWrite(9, h); 
  bridge1.virtualWrite (V26, t);

  

}


void autolightprihoj()     // THE LAWLESSNESS NOW BEGINS HERE
{

if (autoprihoj==0)
  { 




   
 int door=digitalRead(doorprihoj);
  
  
  if(digitalRead(pirprihoj)==HIGH||door==0||digitalRead(pir2prihoj)==HIGH)
  {
    
    if(lockLow)
    {
      lockLow = false;     
      
      digitalWrite(3, LOW);
      Blynk.virtualWrite (V0, LOW);
      
    }        
    takeLowTime = true;
  }

  
  if(digitalRead(pirprihoj)==LOW&&door==1&&digitalRead(pir2prihoj)==LOW)
  {      
    
    if(takeLowTime)
    {
      lowIn = millis();          
      takeLowTime = false;       
    }
   
    if(!lockLow && millis() - lowIn > pause)
    { 
     
      lockLow = true;               
      
      digitalWrite (3, HIGH);
      Blynk.virtualWrite (V0, HIGH);
      
    }

  }
    
       
  }}

void autolightkuh ()
{
 if (autokuh==0)
  { bool needlight= (digitalRead(lightkuh)==HIGH&&digitalRead(pir1kuh)==HIGH)||(digitalRead(lightkuh)==HIGH&&digitalRead(pir2kuh)==HIGH);
    if (needlight)
     {digitalWrite(1, LOW);
      needlightstate = true;

      Blynk.virtualWrite (V3, LOW);
 }
  

      if (needlightstate==true){

if (digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {
    
    if(lockLow2)
    {
      lockLow2 = false;     
      
      digitalWrite(1, LOW);
      Blynk.virtualWrite (V3, LOW);
    }        
    takeLowTime2 = true;
  }

  
  if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {      
    
    if(takeLowTime2)
    {
      lowIn2 = millis();         
      takeLowTime2 = false;       
    }
    
    if(!lockLow2 &&( millis() - lowIn2 > pause2))
    { 
      
      lockLow2 = true;               
      
     
      digitalWrite (1, HIGH);
      Blynk.virtualWrite (V3, HIGH);
      
      needlightstate= false;
    
     }
   
    }}
   
    
    }
  
}

 
 




BLYNK_CONNECTED() {
  
 bridge1.setAuthToken("DDDDDDDDDDD");
 
}


 


void sendnotify ()
{ 
  if (ohrana==0){
  Blynk.virtualWrite (V11, 0);
   if(digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {
  Blynk.virtualWrite (V10, 255);}

 if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {Blynk.virtualWrite (V10, 0);}
  
  
  if (digitalRead(doorprihoj)==0)
 {
   Blynk.virtualWrite (V4, 255);}

if (digitalRead(doorprihoj)==1)
 { 
   Blynk.virtualWrite (V4, 0);}
  
   if(digitalRead(pirprihoj)==HIGH||digitalRead(pir2prihoj)==HIGH)
  { 
   
  Blynk.virtualWrite (V7, 255);}
  
  if(digitalRead(pirprihoj)==LOW&&digitalRead(pir2prihoj)==LOW)
  {Blynk.virtualWrite (V7, 0); 
      }}     
      
   if (ohrana==1){
  Blynk.virtualWrite (V11, 255);
   if(digitalRead(pir1kuh)==HIGH||digitalRead(pir2kuh)==HIGH)
  {Blynk.notify ("Движение на кухне");
  Blynk.virtualWrite (V10, 255);}

 if(digitalRead(pir1kuh)==LOW&&digitalRead(pir2kuh)==LOW)
  {Blynk.virtualWrite (V10, 0);}
  
  
  if (digitalRead(doorprihoj)==0)
 {Blynk.notify ("Входная Дверь открыта"); 
   Blynk.virtualWrite (V4, 255);}

if (digitalRead(doorprihoj)==1)
 {
   Blynk.virtualWrite (V4, 0);}
  
   if(digitalRead(pirprihoj)==HIGH||digitalRead(pir2prihoj)==HIGH)
  { 
  Blynk.notify ("Движение в прихожей"); 
  Blynk.virtualWrite (V7, 255);}
  
  if(digitalRead(pirprihoj)==LOW&&digitalRead(pir2prihoj)==LOW)
  {Blynk.virtualWrite (V7, 0); 
      }}   
      
      }

  
void setup()
{
  
  
  splittimer1 = timer.setTimeout(500, []() {
  timer4= timer.setInterval (1000, autolightkuh);
  });

  splittimer2 = timer.setTimeout(500, []() {
  timer3= timer.setInterval (1000, autolightprihoj);
  });
  
  timer2= timer.setInterval(6300, sendnotify);
  timer1= timer.setInterval(10000, sendUptime);
  
  
 
  pinMode (pirprihoj,INPUT);    
  pinMode (pir2prihoj,INPUT); 
  pinMode (releprihoj,OUTPUT);   
  pinMode (doorprihoj,INPUT);
  pinMode (pir1kuh,INPUT);
  pinMode (pir2kuh,INPUT);
  pinMode (lightkuh,INPUT);
  pinMode (relekuh,OUTPUT);
  dht.begin();
  digitalWrite (releprihoj, HIGH);
  digitalWrite (relekuh, HIGH);
  Blynk.begin(auth, ssid, pass);
}


 BLYNK_WRITE(V0) 
  {if(param.asInt()==0)
{ if (autoprihoj==1) {digitalWrite(releprihoj, LOW);}
if (autoprihoj==0) {
 if (digitalRead (releprihoj)==LOW)
 {Blynk.virtualWrite (V0, LOW);}
 if (digitalRead (releprihoj)==HIGH)
 {Blynk.virtualWrite (V0, HIGH);}}}
  
else { if (autoprihoj==1) {digitalWrite(releprihoj, HIGH);}
if (autoprihoj==0) {
 if (digitalRead (releprihoj)==LOW)
 {Blynk.virtualWrite (V0, LOW);}
 if (digitalRead (releprihoj)==HIGH)
 {Blynk.virtualWrite (V0, HIGH);}}}}

 
 
 





 BLYNK_WRITE(V3) 
  {if(param.asInt()==0)
{ if (autokuh==1) {digitalWrite(relekuh, LOW);}
if (autokuh==0) {
 if (digitalRead (relekuh)==LOW)
 {Blynk.virtualWrite (V3, LOW);}
 if (digitalRead (relekuh)==HIGH)
 {Blynk.virtualWrite (V3, HIGH);}}}
  
else { if (autokuh==1) {digitalWrite(relekuh, HIGH);}
if (autokuh==0) {
 if (digitalRead (relekuh)==LOW)
 {Blynk.virtualWrite (V3, LOW);}
 if (digitalRead (relekuh)==HIGH)
 {Blynk.virtualWrite (V3, HIGH);}}}}

  BLYNK_WRITE(V1) 
 {if(param.asInt()==0)
{ autoprihoj=0;
  }
else {autoprihoj=1;}}

BLYNK_WRITE(V12) 
 {switch(param.asInt())

{case 1: { autokuh=1; break;}
 case 2: { autokuh=0; pause2= 10000; break;}
 case 3: { autokuh=0; pause2= 30000; break;}
 case 4: { autokuh=0; pause2= 60000; break;}
 case 5: {autokuh=0; pause2= 150000; break;}
 case 6: {autokuh=0; pause2=180000; break;}
 }}


BLYNK_WRITE(V17)
 {if(param.asInt()==0)
 {ohrana=1;

 Blynk.notify ("ОХРАНА АКТИВИРОВАНА"); 
 Blynk.virtualWrite (V11, 255);}

 
 else {ohrana=0;

 Blynk.notify ("ОХРАНА ОТКЛЮЧЕНА");
 Blynk.virtualWrite (V11, 0);}}




void loop()
{

   Blynk.run();
  timer.run();
}

Before rebuilding my sketch processing function of one room void autolightkuh () stands in void loop () after the function from room when the problem is now ( void autolightprihoj () ).
After I swapped from place to place in the sketch, the problem went to the room whose code is executed later

This is sequence in void setup ():

void setup()
{
  
  
  splittimer1 = timer.setTimeout(500, []() {
  timer4= timer.setInterval (1000, autolightkuh); \\\the room autolighkuh where the problem was
  });

  splittimer2 = timer.setTimeout(500, []() {
  timer3= timer.setInterval (1000, autolightprihoj); \\\the room where the problem is now
  });
  
  timer2= timer.setInterval(6300, sendnotify);
  timer1= timer.setInterval(10000, sendUptime); 

Change one of those timers from 500 to 0 (or better yet, use 250 and 750).

Otherwise there is no point setting it up the way you have as there is no set split in the time.

timer.setTimeout(250, []() {
  timer4= timer.setInterval (1000, autolightkuh); \\\the room autolighkuh where the problem was
  });

 timer.setTimeout(750, []() {
  timer3= timer.setInterval (1000, autolightprihoj); \\\the room where the problem is now
  });

Now timer4 will go off at 1 second intervals at the 250ms part of the second, and the other at 750ms in to the second, this way they never overlap.
You can also remove the splittimer1 declaration as its kinda a wate of time (I removed it from my example after noticing it).

You should also avoid using odd numbers like that 6300 timer as that will sometimes trigger during your split timers.
Best to use a figure that wont clash.

1 Like

Ookk. My mistake. Not right understand how to use splittimers.
Let’s do that right) I’ll write the result. Thanks again for help, Jamin.

1 Like

Can I apply this improvement to the remaining timers with a longer operation interval?

splittimer1 = timer.setTimeout(200, []() {
  timer4= timer.setInterval (1000, autolightkuh); \\\the room autolighkuh where the problem was
  });

  splittimer2 = timer.setTimeout(400, []() {
  timer3= timer.setInterval (1000, autolightprihoj); \\\the room where the problem is now
  });
  

splittimer3 = timer.setTimeout(600, []() {
  timer2= timer.setInterval(6000, sendnotify);
  });

splittimer4 = timer.setTimeout(800, []() {
  timer1= timer.setInterval(10000, sendUptime);
 });

Almost got it…

timer.setTimeout(200, []() {
  timer4= timer.setInterval (1000, autolightkuh); \\\the room autolighkuh where the problem was
  });

timer.setTimeout(400, []() {
  timer3= timer.setInterval (1000, autolightprihoj); \\\the room where the problem is now
  });
  

timer.setTimeout(600, []() {
  timer2= timer.setInterval(6000, sendnotify);
  });

timer.setTimeout(800, []() {
  timer1= timer.setInterval(10000, sendUptime);
 });

Just changed the 6300 to 6000… otherwise the hte odd 0.3 will send the split timer out of whack,

1 Like

yeah…Just edited and you already wrote.
I hope now it will work like a swiss watch))

I’ll write the result later.

1 Like

I fixed the splitTimers. The sketch works now rather quickly, but hangs remained in part of sketch after the
void setup ().

And the light is still switched on itself in one of the rooms.

There was one more question. I need to set timeouts in time directly in the BLYNK_WRITE (V0) part.

I tried to do both in the sketch below, but this led to an absolutely skimpy D1.

How can I insert this?

 {switch(param.asInt())

{case 1: { 
  if (automus==1&&lock1==0)
  {
    digitalWrite (Musonrelay, LOW);
  Blynk.virtualWrite (V8, LOW);
  
timeoutlow = timer.setTimeout(2000, []() {
  digitalWrite (Musmoderelay, LOW);
  });
   
   timeoutmode= timer.setTimeout(1000, []() {
  digitalWrite (Musmoderelay, HIGH);
  });
   
  lock1==1;
  lock2==0;

  break;}

Edit your post and enter your entire sketch as its hard to figure out what you’re asking just from the snippet.

Hello to everyone.
My problems with bad internet connection in rainy day solved by installing my own local Blynk server on RPI.
But unexpected on/off turns by PIRs still stands.
It`ll be better to make new theme for this, so this theme closed. Thanks to all for help .