DomotzGeneric

DomotzGeneric

Extends

Methods

(static) createMetric(metricData) → {Metric}

Description:
  • Creates a custom driver metric to be sent in the D.success callback.
    This metric is suited for tracking a single key-value pair, if you want to track tabular data, use D.createTable instead.
Example
// returns {"uid": "1a", "unit": "C", "value": 60, "label": "CPU Temperature", "metadata": { "url": "http://example.com/" }}
D.createMetric({ uid: '1a', name: 'CPU Temperature', value: 60, unit: 'C', valueType: D.valueType.NUMBER, metadata: { url: 'http://example.com/' } })
Parameters:
Name Type Description
metricData Object The metric data object containing the following properties:
Properties
Name Type Attributes Description
uid string The identifier of the metric. Must be Unique. Max 50 characters
cannot be one of the following reserved words: "table", "column", "history"
name string The Name/Label of the metric. Max 100 characters
value string The Value of the metric. Max 500 characters
unit string The Unit of measurement of the metric (eg %). Max 10 characters
valueType ValueType The value type of the metric (used for display purposes)
metadata MetricMetadata <optional>
The metadata of the metric, can be used to store additional information
Returns:
Type
Metric

(static) createTable(label, columnHeaders) → {Table}

Description:
  • Creates a driver table for variable values visualization in a table format
Example
D.createTable("My Table", [{"label": "Column A"}, {"label": "Column B", "unit": "%"}])
Parameters:
Name Type Description
label string The Table Label
columnHeaders Array.<ColumnHeader> The List of column header definitions
Returns:
- The Custom Driver Table object
Type
Table

(static) createVariable(uid, name, value, unit, valueType) → {Variable}

Description:
  • Creates a custom driver variable to be sent in the D.success callback.
    This variable is suited for tracking a single key-value pair, if you want to track tabular data, use D.createTable instead.
Deprecated:
  • This function has been deprecated, please use D.createMetric instead.
Example
// returns {"uid": "1a", "unit": "C", "value": 60, "label": "CPU Temperature"}
D.createVariable('1a', 'CPU Temperature', 60, 'C', D.valueType.NUMBER)
Parameters:
Name Type Description
uid string The identifier of the variable. Must be Unique. Max 50 characters
cannot be one of the following reserved words: "table", "column", "history"
name string The Name/Label of the variable. Max 100 characters
value string The Value of the variable. Max 500 characters
unit string The Unit of measurement of the variable (eg %). Max 10 characters
valueType ValueType The value type of the variable (used for display purposes)
Returns:
Type
Variable

(static) success(metricsopt, tableopt)

Description:
  • Success callback in D (D.success). It must be present in validate, get_status or all custom action functions code (or their callbacks) in order to indicate their successful execution
Examples
D.success()
D.success(table)
D.success(variables)
D.success(metrics)
D.success(variables, table)
Parameters:
Name Type Attributes Description
metrics Array.<(Variable|Metric)> <optional>
The metrics to return (dry run) or store
table Table <optional>
The custom driver table to return (dry run) or store