HomeServerConnector. _DataArchive
Methods
Abstract types
new _DataArchive()
Data archive.
May not be directly instanced. An instance of the class is created by the method HomeServerConnector._Connection#getDataArchive.
Example
var da = conn.getDataArchive("DA@MyDataArchive", function(err, data) {});
Methods
destroy()
Enables the object and cancels any existing subscription.
Example
da.destroy();
getData(startDate, blockCount, blockSize, columnList, callback)
Retrieves a selection of data from the archive. The selection is specified via the parameters.
Examples
Retrieval of the archive columns 1, 3 and 4 from 01.01.2016, from 14:00 for a time period of 60 minutes: 30 entries of which each summarises the values from 2 minutes.
var startDate = new Date(2016, 0, 1, 14, 0); // 01.01.2016 14:00
da.getData(startDate, 30, 2, ['#1', '#3', '#4'], function(err, data) {});
Retrieval of the archive columns with the column headers "TARGET" and "ACTUAL" for a time period which began 12 hours ago and lasts 6 hours: 24 entries of which each summarises the values from 15 minutes.
var startDate = da.getStartDateFromHours(12); // NOW - 12 hours
da.getData(startDate, 24, 15, ['TARGET', 'ACTUAL'], function(err, data) {});
Parameters
Name | Type | Optional | Description |
---|---|---|---|
startDate |
Date |
|
Date object. Start time from which the data is to be supplied. |
blockCount |
Number |
|
Number of data blocks to be supplied. |
blockSize |
Number |
|
Size of a data block (in minutes). |
columnList |
Array |
|
List of columns to be displayed. Either keys or indices are listed here. If an index is involved, a '#' must be placed in front of the value. The indices correspond to the from left to right consecutively numbered columns of the archive, beginning with '1'. |
callback |
function() |
|
getKey() → String
Returns the key of the object.
Example
var object_key = da.getKey();
- Returns
-
String
getMeta(callback)
Retrieves the metadata.
Example
Retrieval of metadata
da.getMeta(function(err, data) {});
Parameter
Name | Type | Optional | Description |
---|---|---|---|
callback |
function() |
|
getStartDateFromDays(hours) → Date
Returns a correctly formatted "start date" string for the getData() archive. A number of days is transferred. The date created is NOW - Number of days
Parameter
Name | Type | Optional | Description |
---|---|---|---|
hours |
Number |
|
Number of days deducted from the current time. |
- Returns
-
Date
Date.
getStartDateFromHours(hours) → Date
Returns a correctly formatted "start date" string for the getData() archive. A number of hours is transferred. The date created is NOW - Number of hours
Parameter
Name | Type | Optional | Description |
---|---|---|---|
hours |
Number |
|
Number of hours deducted from the current time. |
- Returns
-
Date
Date.
getStartDateFromWeeks(hours) → Date
Returns a correctly formatted "start date" string for the getData() archive. A number of weeks is transferred. The date created is NOW - Number of weeks
Parameter
Name | Type | Optional | Description |
---|---|---|---|
hours |
Number |
|
Number of weeks deducted from the current time. |
- Returns
-
Date
Date.
Abstract types
getDataCallback(err, data)
Examples
Retrieval of the archive columns 1, 3 and 4 from 01.01.2016, from 14:00 for a time period of 60 minutes: 30 entries of which each summarises the values from 2 minutes.
var startDate = new Date(2016, 0, 1, 14, 0); // 01.01.2016 14:00
da.getData(startDate, 30, 2, ['#1', '#3', '#4'], function(err, data) {});
Retrieval of the archive columns with the column headers "TARGET" and "ACTUAL" for a time period which began 12 hours ago and lasts 6 hours: 24 entries of which each summarises the values from 15 minutes.
var startDate = da.getStartDateFromHours(12); // NOW - 12 hours
da.getData(startDate, 24, 15, ['TARGET', 'ACTUAL'], function(err, data) {});
# Structure of the returned 'data' object with example values for the above call in the 2nd example
{
"columns": {
"ACTUAL": {
"sum": [31, 32, 31, 33],
"cnt": [2, 2, 2, 2],
"min": [15, 16, 15, 16],
"max": [16, 16, 16, 17]
},
"TARGET": {
"sum": [34, 34, 34, 34],
"cnt": [2, 2, 2, 2],
"min": [17, 15, 17, 17],
"max": [17, 19, 17, 17]
},
}
}
Parameters
Name | Type | Optional | Description |
---|---|---|---|
err |
(Object or undefined) |
|
Error object |
data |
Object |
|
Archive information Structure
Explanation
|
getMetaCallback(err, data)
Example
Retrieval of metadata
da.getMeta(function(err, data) {});
Parameters
Name | Type | Optional | Description |
---|---|---|---|
err |
(Object or undefined) |
|
Error object |
data |
Object |
|
Meta information Structure
Explanation
|