+1
Will be answered

Control the routines by script

Christophe MATHEY 5 years ago in Tips and Tricks updated by Paolo Scarpetta 4 years ago 6

Hello Iridium,

I would be interesting to enable/dsable the sever's routines by script.

Get access to the property 'Enable' of routines would be interessting for our end customer..

This point will complet the property of schedule what you are rending access by script...

Hi Aleksandr,

I tried it already. My request will complet it.

In fact, 

   several routines can use the same schedule. It would be best to enable/disable routines than schedule

 

An example, 

     a specific schedule parameter the sunset.

     several routines use it (close shutters / activate detection for light, etc),

 But, if user want to desactivate closing shutter only... actually it needs to write several schedules which are similar.

it is not logic.

I hope I have been clear with my little english....

Best regards

Will be answered

Yes, now I see.

Now there is no such method for shutting down the routine, but we have some improvement in the mechanism that we are testing now and after that methods will be available to turn the routine on and off. After the release (1-2 months) I will write to you how it will work.

It is a great new.

Thank you.

+3

Any update on this? I also looking for enable/disable routine,

I already look in https://dev.iridi.com/Demo_schedule_edit 

it refer to IR.GetScheduler()

but it can not find any document on this method 

or how can I simple update start/end date time like this: (how about date time format should i use?)

var mMonth = IR.GetVariable("System.Date.Month");

var schedule_i_want = IR.GetScheduler("Schedule 1").GetEvents("NIGHT_LIGHT");

       if(mMonth <= 2 || mMonth>= 9)
       {//WINTER
            IR.Log("updateSchedule to WINTER");
            schedule_i_want.Start = "2019-09-29 18:00:00"; //what date time format shouid i use here?*/
            schedule_i_want.End = "2019-09-30 06:15:00"; 
            schedule_i_want.Enabled = true;
            schedule_i_want.Done();
       }
       else
       {//SUMMER
            IR.Log("updateSchedule to SUMMER");       
            schedule_i_want.Start = "2019-09-29 18:30:00";
            schedule_i_want.End = "2019-09-30 06:00:00"; 
            schedule_i_want.Enabled = true;
            schedule_i_want.Done();            
       } 


I share something that I did for this, I created a virtual variable and in the routine I put the condition "only if" that virtual variable is in 1, in this way the user can activate or deactivate the routine with a button