new _UniversalTimer()

Universal timer. May not be directly instanced. An instance of the class is created by the method HomeServerConnector._Connection#getUniversalTimer.

Example

var ti = conn.getUniversalTimer("TI@MyTimer", function(err, data) {});

Methods

addEvent(eventObj, callback)

Adds a new Ereignis to the universal timer.

Example

var evt = {"date_type": 1, "weekdays": [0,1,2,3,4], "time_type": 1, "time": "1200", "filter": 0, "action": 1};
ti.addEvent(evt, function(err) {});

Parameters

Name Type Optional Description

eventObj

Object

 

Event object

callback

function()

 

HomeServerConnector._UniversalTimer~addEventCallback

deleteEvent(eventId, callback)

Deletes an Ereignis from the universal timer.

Example

var eventId = evt.getId();
ti.deleteEvent(eventId, function(err) {});

Parameters

Name Type Optional Description

eventId

Number

 

The ID of an event.

callback

function()

 

HomeServerConnector._UniversalTimer~deleteEventCallback

destroy()

Enables the object and cancels any existing subscription.

Example

ti.destroy();

getEvents(callback)

Returns a list with all Ereignissen of the timer.

Example

ti.getEvents(function(err, events) {});

Parameter

Name Type Optional Description

callback

function()

 

HomeServerConnector._UniversalTimer~getEventsCallback

getKey() → String

Returns the key of the object.

Example

var object_key = ti.getKey(); 
Returns

String 

getMeta(callback)

Retrieves the metadata.

Example

Retrieval of metadata.

ti.getMeta(function(err, data) {});

Parameter

Name Type Optional Description

callback

function()

 

HomeServerConnector._UniversalTimer~getMetaCallback

getSimulation(days, callback)

Returns the times within the specified time period at which Ereignisse are triggered.

Example

Retrieval of the events for the coming 7 days.

ti.getSimulation(7, function(err, events) {});

Parameters

Name Type Optional Description

days

Number

 

Number of days (from now) to be calculated.

callback

function()

 

HomeServerConnector._UniversalTimer~getSimulationCallback

getState(callback)

Retrieves the status (active/inactive) of the universal timer.

Example

Retrieval of the status.

ti.getState(function(err, active) {});

Parameter

Name Type Optional Description

callback

function()

 

HomeServerConnector._UniversalTimer~getStateCallback

setState(state, callback)

Sets the status (active/inactive) of the universal timer.

Example

Setting the status.

ti.setState(true, function(err) {});

Parameters

Name Type Optional Description

state

boolean

 

true: The universal timer is activated (or remains switched on)
false: The universal timer is deactivated (or remains switched off)

callback

function()

 

HomeServerConnector._UniversalTimer~setStateCallback

updateEvent(eventId, eventObj, callback)

Changes/sets the values of an Ereignisses.

Example

var evt = {"date_type": 1, "weekdays": [0,1,2,3,4], "time_type": 1, "time": "1200", "filter": 0, "action": 1};
ti.updateEvent(47, evt, function(err) {});

Parameters

Name Type Optional Description

eventId

Number

 

The ID of the event to be reset.

eventObj

Object

 

The event object to be used.

callback

function()

 

HomeServerConnector._UniversalTimer~updateEventCallback

verify(eventObj) → boolean

Checks an Ereignis-Objekt. Returns whether it is consistent.

Example

ti.verify({});  // Returns false
ti.verfiy({"date_type": 1, "weekdays": [0,1,2,3,4], "time_type": 1, "time": "1200", "filter": 0, "action": 1});  // Returns true

Parameter

Name Type Optional Description

eventObj

Object

 

The event object to be checked

Returns

boolean 

Abstract types

inner

addEventCallback(err)

Example

var evt = {"date_type": 1, "weekdays": [0,1,2,3,4], "time_type": 1, "time": "1200", "filter": 0, "action": 1};
ti.addEvent(evt, function(err) {});

Parameter

Name Type Optional Description

err

(Object or undefined)

 

Error object

inner

deleteEventCallback(err)

Example

var eventId = evt.getId();
ti.deleteEvent(eventId, function(err) {});

Parameter

Name Type Optional Description

err

(Object or undefined)

 

Error object

inner

getEventsCallback(err, events)

Example

Retrieve a list of all events

ti.getEvents(function(err, events) {});

Parameters

Name Type Optional Description

err

(Object or undefined)

 

Error object

events

Array

 

List with all Ereignissen of the timer.

inner

getMetaCallback(err, data)

Example

Retrieval of metadata.

ti.getMeta(function(err, data) {}); 

Parameters

Name Type Optional Description

err

(Object or undefined)

 

Error object

data

Object

 

Meta information

Structure

{
  "keys":           Array of String, 
  "caption":        String,
  "description":    String,
  "tags":           Array of String,
  "actions": [
     {
        "id":       Number, 
        "text":     String, 
        "commands": Number
     }
  ]
}

Explanation

  • keys - List with keys (e.g.: ["TI:7", "TI@MyTimer"]). Contains at least one number.
  • caption - Designation of the object.
  • description - Description of the object.
  • tags - List of tags (e.g.: ["shutter", "window"]).
  • actions - List of all stored actions.
    • id - ID of the action.
    • text - Designation of the action.
    • commands - Number of stored commands.
inner

getSimulationCallback(err, events)

Example

Retrieval of the events for the coming 7 days.

ti.getSimulation(7, function(err, events) {});

Parameters

Name Type Optional Description

err

(Object or undefined)

 

Error object

events

Array

 

List with the Ereignissen of the timer within the specified time period.

Structure

[
    {
      "event_id": Number,
      "ts":       Number,
      "random":   Number
    }
]  

Explanation

  • event_id - ID of the event.
  • ts - Unix time stamp (in seconds, milliseconds as a decimal value) of the event time. The time can still be influenced by the field random.
  • random - Time range in minutes in which the event can be triggered. The time lies in the range between ts - (random*60) and ts + (random*60), but never earlier than 0:00:00 or later than 23:59:59.
inner

getStateCallback(err, active)

Example

Retrieval of the status.

ti.getState(function(err, active) {}); 

Parameters

Name Type Optional Description

err

(Object or undefined)

 

Error object

active

Boolean

 

true: Universal timer is switched on - false: Universal timer is switched off

inner

setStateCallback(err)

Example

Setting the status.

ti.setState(true, function(err) {});

Parameter

Name Type Optional Description

err

(Object or undefined)

 

Error object

inner

updateEventCallback(err)

Example

var evt = {"date_type": 1, "weekdays": [0,1,2,3,4], "time_type": 1, "time": "1200", "filter": 0, "action": 1};
ti.updateEvent(47, evt, function(err) {});

Parameter

Name Type Optional Description

err

(Object or undefined)

 

Error object