Sleep function on irrigation system

Hello,

Ii need your help to adapt below sleep code to my code. I need to Keon where I should introduce it and how it works. The disable part is already working. In my GUI I have a button to select how many days (between 0-7) my irrigation system will stop watering but the schedule will keep working and when the selected days will finish, system will work again.

//  Pin ( SCHEDULER_CNT*(TIME_CNT+3) ) +3 used for system sleep button          //
// define disable system input and number of days to disable input
#define VP_SLEEP_SYS (VP_MAX_DUR_SCHD0+SCHEDULER_CNT+3)

// system disable timer
uint8_t  disable_timer_id = 32;                     // When system is disabled or at sleep a timer is set to wake 
                                                    //   the system disable_timer_id saves this timer ID

// system disable days 
int32_t  system_disable_days_sec;                  // VP_DISBL_DAYS defines days to disable/sleep the system (including today) given in sec

/////////////////////////////////////////////////////////////////////////////////////
// End of Sleep and Disable Modes                                                   //
//  (They will probably not be used together so if one ends the other must end too) //
//////////////////////////////////////////////////////////////////////////////////////
void sleep_disable_mode_off()
{
   system_sleep_mode = false;       
   // iterate over all schedulers and re reactivate tasks if needed (sleep mode).
   for (int scheduler_cnt = 0;  scheduler_cnt< SCHEDULER_CNT; scheduler_cnt++) 
      if(active_end_time_sec[scheduler_cnt]!=TIME_MAX) task_on_off(HIGH, scheduler_cnt); 

   // enable main timer (only if in disable mode)    
   SystemTimer.enable(main_timer_id); 
    
   // set disable and sleep buttons to off
   Blynk.virtualWrite(VP_SLEEP_SYS,V33);

   // set disable timer id to 32 to prevent disabling system timer by mistake
   SystemTimer.deleteTimer(disable_timer_id);
   disable_timer_id = 32;
   
   Serial.println(String("Sleep/Disable mode off"));

  ///////////////////////////////////////////////////////////////////////
  // SYSTEM DISABLE/SLEEP BUTTONS INPUT                                //
  ///////////////////////////////////////////////////////////////////////
  else if((pin == VP_DISBL_SYS )|(pin == VP_SLEEP_SYS)){                   // V31 & V32
       if (param.asInt()!=0){ 
        
          String currentDate = String(day()) + "\\" + month() + "\\" + year();
          
          if (pin == VP_SLEEP_SYS){
            system_sleep_mode = true;
            // turn off all tasks (do not disable the schedulers )
            for (int task_cnt = 0;  task_cnt< SCHEDULER_CNT; task_cnt++) 
              task_on_off(LOW, task_cnt);

            // print current data on VP_SLEEP_SYS button
            Blynk.setProperty(VP_SLEEP_SYS, "onLabel", currentDate);
          }
          else{
             // disable main time tick 
             SystemTimer.disable(main_timer_id);   
             // turn off all active schedulers  
             Serial.println(String("Disable all"));
             for (int scheduler_cnt = 0;  scheduler_cnt< SCHEDULER_CNT; scheduler_cnt++) 
               scheduler_turn_off(scheduler_cnt);
             // print current data on VP_SLEEP_SYS button
             Blynk.setProperty(VP_DISBL_SYS, "onLabel", currentDate);              
          }
          // if disable days is 0 then set nowseconds to -1 to prevent timer with negative duration  
          int32_t nowseconds = -1; 
          if (system_disable_days_sec!=0)
             nowseconds = elapsedSecsToday(now());
             
          // create a timer to wake the system up after system_disable_days_sec are over
          SystemTimer.deleteTimer(disable_timer_id); // make sure no disable timer is active
          disable_timer_id = SystemTimer.setTimeout(1000*(system_disable_days_sec-nowseconds),sleep_disable_mode_off);
        }
        else {// if system is manually out of seep mode delete disable timer and enable schedulers
          sleep_disable_mode_off();
        }
  }

Thks in advance