DataPoint
The DataPoint object represents a value, typically used to represent the state of an endpoint at a given moment.
Properties
### value (number) The value property represents the endpoint value as a number. See the table at the end of this section for the endpoint types to which this property applies and its meaning.
Examples
This example shows the current value of the first endpoint of a device, through the log console.
env.log('Endoint value: ', myDevice.endpoints.byIndex(0).getCurrentValue().value);### isOn (boolean) The isOn property indicates whether the endpoint is currently turned on. See the table at the end of this section for the endpoint types to which this property applies and its meaning.
Examples
This example shows the current state of the first endpoint of a device, through the log console.
env.log('Endoint state: ', myDevice.endpoints.byIndex(0).getCurrentValue().isOn);### state (number) The state property indicates the current state of the endpoint. This property applies to IAS Sensor type endpoints.
Examples
This example shows the current state of the first endpoint of a device, through the log console.
env.log('Endoint state: ', myDevice.endpoints.byIndex(0).getCurrentValue().state);### position (number) The position property indicates the current position, for Closure type endpoints.
Examples
This example shows the current position of the first endpoint of a device, through the log console.
env.log('Endoint position: ', myDevice.endpoints.byIndex(0).getCurrentValue().position);### mode (number) The mode property indicates the current mode of a Thermostat type endpoint.
Examples
This example shows the current mode of the first endpoint of a device, through the log console.
env.log('Thermostat mode: ', myDevice.endpoints.byIndex(0).getCurrentValue().mode);### fanMode (number) The fanMode property indicates the current fan mode of a Thermostat type endpoint.
Examples
This example shows the current fan mode of the first endpoint of a device, through the log console.
env.log('Fan mode: ', myDevice.endpoints.byIndex(0).getCurrentValue().fanMode);### setpoint (number) The setpoint property indicates the desired temperature for a Thermostat type endpoint.
Examples
This example shows the desired temperature of the first endpoint of a device, through the log console.
env.log('Setpoint: ', myDevice.endpoints.byIndex(0).getCurrentValue().setpoint);### ambientTemperature (number) The ambientTemperature property indicates the current ambient temperature of a Thermostat type endpoint.
Examples
This example shows the current ambient temperature of the first endpoint of a device, through the log console.
env.log('Ambient temperature: ', myDevice.endpoints.byIndex(0).getCurrentValue().ambientTemperature);### latitude (number) The latitude property indicates the latitude for a Location Tracker type endpoint.
Examples
This example shows the current coordinates of the first endpoint of a device, through the log console.
var v = myDevice.endpoints.byIndex(0).getCurrentValue();
env.log('Coordinates: ', v.latitude, ' - ', v.longitude);### longitude (number) The longitude property indicates the longitude for a Location Tracker type endpoint.
Examples
This example shows the current coordinates of the first endpoint of a device, through the log console.
var v = myDevice.endpoints.byIndex(0).getCurrentValue();
env.log('Coordinates: ', v.latitude, ' - ', v.longitude);### flags (number) The flags property indicates the special conditions of a Location Tracker type endpoint.
Examples
This example shows the flags of the first endpoint of a device, through the log console.
env.log('Flags: ', myDevice.endpoints.byIndex(0).getCurrentValue().flags);### activeEnergy (number) The activeEnergy property indicates the active energy of an Energy Meter type endpoint.
Examples
This example shows the active, reactive, and apparent energy of the first endpoint of a device, through the log console.
var v = myDevice.endpoints.byIndex(0).getCurrentValue();
env.log('Energy (active / reactive / apparent): ', v.activeEnergy, '/', v.reactiveEnergy, '/', v.apparentEnergy);### reactiveEnergy (number) The reactiveEnergy property indicates the reactive energy of an Energy Meter type endpoint.
Examples
This example shows the active, reactive, and apparent energy of the first endpoint of a device, through the log console.
var v = myDevice.endpoints.byIndex(0).getCurrentValue();
env.log('Energy (active / reactive / apparent): ', v.activeEnergy, '/', v.reactiveEnergy, '/', v.apparentEnergy);### apparentEnergy (number) The apparentEnergy property indicates the apparent energy of an Energy Meter type endpoint.
Examples
This example shows the active, reactive, and apparent energy of the first endpoint of a device, through the log console.
var v = myDevice.endpoints.byIndex(0).getCurrentValue();
env.log('Energy (active / reactive / apparent): ', v.activeEnergy, '/', v.reactiveEnergy, '/', v.apparentEnergy);### text (string) The text property indicates the text associated with a Text Container type endpoint.
Examples
This example shows the text associated with the first endpoint of a device, through the log console.
env.log('Text: ', myDevice.endpoints.byIndex(0).getCurrentValue().text);DataPoint object properties for each endpoint type
| Property | Endpoint type | Meaning |
|---|---|---|
| value | Numeric endpoints (scalar, discrete, etc.) | Current value |
| Appliance | Off: 0On: 1 | |
| Dimmer | Off: 0On: current level | |
| Closure | Current position | |
| IAS Sensor | Current state | |
| isOn | Appliance / Dimmer / Thermostat | Off: falseOn: true |
| Closure | Stopped: falseMoving: true | |
| state | IAS Sensor | Current state |
| position | Closure | Current position |
| mode | Thermostat | Current mode |
| fanMode | Thermostat | Current fan mode |
| setpoint | Thermostat | Desired temperature |
| ambientTemperature | Thermostat | Ambient temperature |
| latitude | Location tracker | Latitude |
| longitude | Location tracker | Longitude |
| flags | Location tracker | Location flags |
| activeEnergy | Energy Meter | Active energy |
| reactiveEnergy | Energy Meter | Reactive energy |
| apparentEnergy | Energy Meter | Apparent energy |
| text | Text container | Current text |