HomeServerConnector. _UniversalTimer
Methods
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() |
|
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() |
|
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() |
|
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() |
|
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() |
|
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() |
|
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) |
callback |
function() |
|
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() |
|
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
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 |
deleteEventCallback(err)
Example
var eventId = evt.getId();
ti.deleteEvent(eventId, function(err) {});
Parameter
Name | Type | Optional | Description |
---|---|---|---|
err |
(Object or undefined) |
|
Error object |
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. |
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
Explanation
|
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
Explanation
|
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 |
setStateCallback(err)
Example
Setting the status.
ti.setState(true, function(err) {});
Parameter
Name | Type | Optional | Description |
---|---|---|---|
err |
(Object or undefined) |
|
Error object |
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 |