Timers

Timers are designed to schedule system events in time.


Queries for managing timers:

addtimer - add a timer. Extra options are:

  • k - user session ID;
  • id - the identifier of the element; if the identifier is absent, a new element of the type 'timer' is created, otherwise the existing one is modified;
  • name - the name of the timer, not more than 63 characters;
  • begin - the timer start time (the Unix Time Stamp format), in schedule mode it is not used;
  • end - the timer expiration time (the Unix Time Stamp format), in schedule mode it is not used;
  • mode - timer mode: "once" - once; "week" - every week; "monthly" - every month; "schedule" - hourly schedule for each day of the week;
  • days - depending on the mode:
    •  the days of the week of the timer operation, a bit field in which each bit is responsible for triggering on the corresponding day of the week;
      0 (junior) - Monday;
      1 - Tuesday;
      2 - Wensday;
      3 - Thursday;
      4 - Friday;
      5 - Saturday;
      6 - Sunday;
      ie, for example, to tigger the timer on Monday, Wednesday and Friday you must specify:
      days=(1<<0) | (1<<2) | (1<<4) = 0b00010101 = 0x15
    • days of the month of the timer operation, a bit field in which each bit is responsible for triggering on the corresponding day of the month;
      ie, for example, to activate the timer 1, 3 and 5 of each month, you must specify:
      days=(1<<1) | (1<<3) | (1<<5) = 0b00101010 = 0x2a
    • in schedule mode it is not used;
  • daypattern - used only in schedule mode. It is a string of bit fields in decimal form, separated by commas. Each field corresponds to one day of the week, from Monday to Sunday. Each bit encodes the corresponding hour in days (0-23): 0 - the timer is inactive, 1 - the timer is active.


deltimer - delete the timer. Extra options are:

  • k -user session ID;
  • timer - the identifier of the element.


getelement - read the element. Required parameters are:

  • k - user session ID;
  • id - element ID.

The response contains information about the element:

<element id="501001" module="2010" num="1" clas="devirt" type="timer" name="my_timer" 
state="alarm"
value="1453731709" begin="32400" end="61200" days="31" mode="weekly" daypattern="0,159632,456993,158,0,3365,77" />