Skip to content

Module thc_Timer

Andreas Drollinger edited this page Nov 8, 2019 · 15 revisions

Job timer

Introduction

This module provides a Timer that allows controlling device states at a certain time, and in a certain interval. User can set and delete timers from the default web application (see Web interface). The timer settings are backed up in the recovery file defined by thc::ConfigureRecoveryFile, and restored after a restart of THC.

thc_Timer module commands


Proc: thc::Timer::Define

Registers a new timer task. A timer task allows controlling a device state at a certain time and in a certain interval.

Parameters

Parameters Description
<Time> Timer time. Absolute and relative time definitions are accepted. Supported formats: See the -time argument of <thc::DefineJob>.
<Device> Device that will be controlled
<Command> Device control command. Allowed commands are: 'On', 'Off', 'Switch', 'Set <Value>'. The commands are case insensitive.
[<Repeat>] Task repetition. Absolute time definitions are accepted. No repetition will be performed if set to "". Supported formats: See the -repeat argument of <DefineJob>.
[<Description>] Timer description (for logging purposes).

Returns

Timer job identifier

Examples

 thc::Timer::Define "2015-01-06 08:30" Surveillance,state Off 7d
 -> timer0

 thc::Timer::Define 08h30m LightLiving,state Switch 5m "Light switch"
 -> timer1

See also

thc::Timer::Delete, thc::Timer::List


Proc: thc::Timer::Delete

Delete one or multiple timer tasks.

Parameters

Parameters Description
TaskTag Jobs specified by its tags. This argument can be repeated to delete multiple jobs. The 'timer' prefix can be omitted.

Returns

-

Examples

 thc::Timer::Delete timer15 timer7
 thc::Timer::Delete 15 7

See also

thc::Timer::Define, thc::Timer::List


Proc: thc::Timer::List

List all active timer tasks. The returned result is a list of timer task definitions. Each timer task definition itself is a list composed by the following elements:

  • Task identifier
  • Next execution time
  • Controlled device
  • Device control command
  • Repetition
  • Description

Parameters

-

Returns

Timer task list

Examples

 thc::Timer::List
 -> {timer2 {Tue Jan 06 08:30:00 CET 2015} Surveillance,state On {} \
            {Timer 2: Surveillance,state On @ 2015-01-06 08:30, rep=''}} \
    {timer3 {Tue Jan 06 09:30:00 CET 2015} Surveillance,state Off 3600 \
            {Timer 3: Surveillance,state Off @ 2015-01-06 09:30, rep='1h'}}

See also

thc::Timer::Define, thc::Timer::Delete