Simple 4 relay irrigation scheduler


@hagay I set timer start 1:05 emd 1:06 but start time 1:05 timer Start and finish at the same time. i see from debug. I removed slider and fix it.

  // MAX DURATION SLIDER INPUT                                                      //
  else if (pin >= VP_MAX_DUR_SCHD0) {                                       //V24..V27
     if (pin < VP_MAX_DUR_SCHD0+SCHEDULER_CNT){ 
         max_duration_sec[pin-VP_MAX_DUR_SCHD0] = 86400;
         max_duration_sec[pin-VP_MAX_DUR_SCHD0] = 864000; // set to 10 days is equivalent to not setting max duration
  else if (pin >= VP_IMMD_ACTV_SCHD0) {                                     //V20..V23
    if ( pin <(VP_IMMD_ACTV_SCHD0+SCHEDULER_CNT) ) {
      if (param.asInt()==0)
        scheduler_turn_off(pin-VP_IMMD_ACTV_SCHD0, 0);
        (pin-VP_IMMD_ACTV_SCHD0,TIME_CNT); // immediate turn on using duration from slider
  // DEFAULT ACTIVE DURATION SLIDER INPUT                                          //
  else if (pin >= VP_ACTV_DUR_SCHD0) {                                       //V16..V19
    // default duration is written in extra "timer"
    if (pin <VP_ACTV_DUR_SCHD0+SCHEDULER_CNT) active_duration_sec[pin-VP_ACTV_DUR_SCHD0][TIME_CNT] = 86400;


@hagay I’ve been studying your code trying to understand its operation. Am I correct that pressing System Sleep will prevent any events from turning on until system sleep button is pressed again? Schedule timers are still running but can’t turn anything on.
However system disable shuts down schedule timers but has limited duration based on shutdown duration?


Yes the sleep mode will temporally turn off all tasks keeping them (and schedule events) live in the background. For example if I use this to control my garden irrigation I may want to temporally prevent the sprinklers while I am out, but once I go in again I want everything to return to it’s prev state.

System disable will shut down everything (turn off every active device and all schedulers) and after end of “disable time” it will only activate devices when reaching start time (not due to old schedules). For example if I connect this to my boiler and am going out to the weekend. Then I will disable the system for the next few days.

The duration of both (if not manually deactivated) is defined by the Disable Days slider.

I see the sleep mode as a more short term then the disable mode. Therefore for my sprinklers I will set the disable days to 0 (Or I can remove it from my app) so that if I forget to activate the system again it will still operate the next day.
Of course you may have your own use case where you can see differently.

split this topic #84

A post was merged into an existing topic: How to make Blynk.sync ALL after the power loss?


Hi Arizona, I like your code but I would like to modify your App.

I want control “Zone 1” output with 2 differents start time.

0- Zone 1 T1 (Pin V0) > I use only a start time (Allow start/stop input > NO) : OK (Work fine)
1- I want use a “Zone 1 Duration (MIN)” (Pin V16) for end setting of the Zone 1 : OK (Work fine)

2- I want use a “MAX DURATION” (Pin V24) for end setting of the Zone 1 for a second Zone 1 T2 (Pin V1)

3- These 2 end settings are independents for each 4 Zones.

I’m not able to change your code to get what I want to have mentioned.

Help me. Thank you

Note : I use this hardware




I am running your code and GUI on my NodeMCU. Thks a lot for your good work. I want to add a Rain Delay of maximum 7 days. On GUI I already did under Virtual Pin V33.

  1. is your code ready to do that?
  2. if I select for example 2 days delay. Is it necessary to click on OFF button V50?



Approved 101,

The code I posted does not have rain delay. hagay”s code has what you need but you have to integrate his code into yours. Hagay is an advanced programmer.

I tried to integrate his rain delay into my code but I could not figure it out. I just slide the system to offf manually when it rains.


Thks for your reply. I already show the code in Hagay’s code the reference to Sleep function. I am tripping to adapt but it is not easy for me. For the time being I will use as you are doing. I am able to run it, I will share.