Automatic scheduler. ESP-01 with 4 Time Input Widgets

Dear Sir,
can you update me when your corrected Blynk Android App will be available at the Google play? I asked this ( and not only one time, I didn’t get any answer till now ) because I use time input widget and two of my friends use this but they can not update the Blynk Android App the testing version that you gave us, due to fact that they are not very technology familiar…
Please answer to me.

Thanks and Best Regards,
Mike Kranidis

Hi
How i can work with this:
Start time: eg. 21:00
Stop time: eg. 04:00 next day

For now start time must be earlier than stop time to work correct

@lancer2000 are you using the project exactly as it was produced or are you planning to modify it to your own requirements?

Incorrect.

The code actually has independent trigger windows for ON and OFF. As long as “tomorrow” is covered by the day selection then OFF can be set to an earlier time than the ON time.

So it would fail to turn OFF on Saturday morning and Monday morning if you were using the MONDAY - FRIDAY and SATURDAY - SUNDAY categories respectively. With ALL DAYS or UP TO YOU set for today and tomorrow it will be fine.

1 Like

I tried at morning and works fine, but now i change times and again don’t work.
Relay is ON on time, but in half second is OFF, and so it repeats every 10s until stop time.

Sometimes works, sometimes not. I do not know what it depends on

What times are you setting when it fails and which of the 4 schedulers are you using?

And repeat:

are you using the project exactly as it was produced or are you planning to modify it to your own requirements?

I use originally project, for now i no need to modify.
“All days” and “Up to you” i use, on both is the same problem.
Eg. i set Start time at 21:15 and stop time 10:00

I have now noticed:
When time = start time then relay is ON and in half second OFF, this repeats until 10s but 1 minute later (when time is not exacly start time) relay is OFF but should be ON.

Start time: 21:30
Stop time: 10:00

When time is 21:30 relay “clicking” repeats until 10s
When time is 21:31 relay is OFF, not “clicking”

Hi @lancer2000,
At the moment the project goes like this, the Stop time MUST be later the Start time, otherwise the project doesn’t work fine… I’m sorry for that limitation… I’m involved in other project so I have no time to rebuild the whole code…

Hi, we have also some terminal issues, with fix to them we’ll release a build immediately. I’ll provide guys with a build to check terminal issues today.

1 Like

I modify All_days function. For now work, but still testing

 BLYNK_WRITE(V8)//All days
{  
  if (alldays==1) {         
    sprintf(Date, "%02d/%02d/%04d",  day(), month(), year());
    sprintf(Time, "%02d:%02d:%02d", hour(), minute(), second());

    TimeInputParam t(param);
  
    terminal.print("All Days Checked schedule at: ");
    terminal.println(Time);
    terminal.flush();
    int dayadjustment = -1;  
    if(weekday() == 1){
      dayadjustment =  6; // needed for Sunday, Time library is day 1 and Blynk is day 7
    }
    if(t.isWeekdaySelected(weekday() + dayadjustment)){ //Time library starts week on Sunday, Blynk on Monday
    terminal.println("ALL DAYS ACTIVE today");
    terminal.flush();
    if (t.hasStartTime()) // Process start time
    {
      terminal.println(String("Start: ") + t.getStartHour() + ":" + t.getStartMinute());
      terminal.flush();
    }
    if (t.hasStopTime()) // Process stop time
    {
      terminal.println(String("Stop : ") + t.getStopHour() + ":" + t.getStopMinute());
      terminal.flush();
    }
    // Display timezone details, for information purposes only 
    terminal.println(String("Time zone: ") + t.getTZ()); // Timezone is already added to start/stop time 
  //  terminal.println(String("Time zone offset: ") + t.getTZ_Offset()); // Get timezone offset (in seconds)
    terminal.flush();
  
     for (int i = 1; i <= 7; i++) {  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)
        if (t.isWeekdaySelected(i)) {
        terminal.println(String("Day ") + i + " is selected");
        terminal.flush();
        }
      } 
    nowseconds = ((hour() * 3600) + (minute() * 60) + second());
    startsecondswd = (t.getStartHour() * 3600) + (t.getStartMinute() * 60);
    //Serial.println(startsecondswd);  // used for debugging
    if(nowseconds >= startsecondswd){    
      terminal.print("ALL DAYS STARTED at");
      terminal.println(String(" ") + t.getStartHour() + ":" + t.getStartMinute());
      terminal.flush();
      if(nowseconds <= startsecondswd + 90){    // 90s on 60s timer ensures 1 trigger command is sent
        digitalWrite(pompa, LOW); // set LED ON
        Blynk.virtualWrite(V2, 1);
        // code here to switch the relay ON
      }      
    }
    else{
      terminal.println("All Day Device NOT STARTED today");
      terminal.flush();            
    }
    stopsecondswd = (t.getStopHour() * 3600) + (t.getStopMinute() * 60);
    //Serial.println(stopsecondswd);  // used for debugging
    if((nowseconds >= stopsecondswd) && (stopsecondswd>startsecondswd)){
      digitalWrite(pompa, HIGH); // set LED OFF
      Blynk.virtualWrite(V2, 0);
      terminal.print("All day STOPPED at");
      terminal.println(String(" ") + t.getStopHour() + ":" + t.getStopMinute());
      terminal.flush();
      if(nowseconds <= stopsecondswd + 90){   // 90s on 60s timer ensures 1 trigger command is sent
        digitalWrite(pompa, HIGH); // set LED OFF
        Blynk.virtualWrite(V2, 0);
        // code here to switch the relay OFF
      }              
    }
    else{
      if(nowseconds >= startsecondswd){  
        digitalWrite(pompa, LOW); // set LED ON  TEST!!!!!
        Blynk.virtualWrite(V2, 1);
        terminal.println("All day is ON");
        terminal.flush();
      }          
    }
    if((nowseconds >= stopsecondswd) && (stopsecondswd<startsecondswd) && (nowseconds<startsecondswd)){
      digitalWrite(pompa, HIGH); // set LED OFF
      Blynk.virtualWrite(V2, 0);
      terminal.print("All day STOPPED at");
      terminal.println(String(" ") + t.getStopHour() + ":" + t.getStopMinute());
      terminal.flush();
      if(nowseconds <= stopsecondswd + 90){   // 90s on 60s timer ensures 1 trigger command is sent
        digitalWrite(pompa, HIGH); // set LED OFF
        Blynk.virtualWrite(V2, 0);
        // code here to switch the relay OFF
      }              
    }
  }
  else{
    terminal.println("All day INACTIVE today");
    terminal.flush();
    // nothing to do today, check again in 30 SECONDS time    
  }
  terminal.println();
}
}

Output is revert for my relay

We have uploaded new release with fixes to TimeInput and Terminal, so soon it will be available

2 Likes

Thanks a lot.

please help me… why start time only from 10 :00 >, if use from < 10:00…relay is not ON?

Hi @Kangmas_Hadi,
Could you please elaborate? not sure if I understand your post… :face_with_raised_eyebrow:
On the other hand, did you change the Time Input Widgets and RTC to your location?

i am from indonesia i was setting GMT + 7 asia/jakarta…if now the clock e.g at 06.00 a.m…the relay is ON stop time only can setting until under 10 :00… but above at 10:00 relay is can not setting ON.

if now the clock e.g at 18.00…the relay start time only can setting above 10 :00…but under 10:00 relay can not setting ON…

please help me to solve the case above…?

@Kangmas_Hadi do you have the very latest version of the app as a timezone bug was introduced in the previous version? Basically the widget reverted to UTC and that could explain why your ON and OFF were mixed up.

1 Like

hello you send me your code i want only 1 time input . i trying and always be wrong ? your code have 1 time input please send me your code and QR code thank you :slight_smile: have good time

Dear @tariktumanbay, I’m really sorry but this is not a code factory as you should understand…
You can start here:

https://community.blynk.cc/search

2 Likes

ok thank you psoro

1 Like