new WirelessTagSensor(tag, sensorType)
Represents a sensor of a WirelessTag. Physical tags have
multiple sensors (e.g., tenperature, humidity, light, motion, etc),
as well as dynamic status (such as out of range) and numeric (such
as signal strength and battery voltage) properties. We abstract all
of these out to sensors, which allows us to treat temperature, out
of range status, and battery voltage as conceptually the
same. Sensors do not all have the same capabilities (e.g., some can
be armed for monitoring, others, such as signal, cannot). However,
all sensors have a type (humidity, motion, light, signal, etc).
A user will not normally need to create instances directly; instead
they are found, and created by WirelessTag#discoverSensors.
Parameters:
| Name | Type | Description | 
|---|---|---|
| tag | WirelessTag | the tag instance that has this sensor | 
| sensorType | string | the type of the sensor | 
Properties:
| Name | Type | Description | 
|---|---|---|
| reading | number | string | boolean | The current reading of the sensor. The type of the value depends on the type of sensor. Some sensors (light, temperature, humidity, moisture, battery, signal) have numeric readings, some (outofrange, water) have boolean, and some (event) have string values. For some sensors (currently only motion) the reading is undefined because the Wireless Tag platform does not provide access to a regularly updated value. | 
| eventState | string | The current event state of the sensor.
            Unarmed sensors will be in state  | 
| eventStateValues | Array.<string> | the possible values for  | 
| probeType | string | only for temperature ( | 
| probeDisconnected | boolean | 
 | 
| gracePeriod | number | only for  | 
- Source:
Members
callAPI :function
Type:
- function
- Source:
sensorType :string
Type:
- string
- Source:
wirelessTag :WirelessTag
Type:
- Source:
Methods
arm(callbackopt) → {Promise}
Arms this sensor.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| callback | module:wirelesstags~apiCallback | <optional> | 
- Source:
Throws:
- 
        if the sensor does not support arming 
Returns:
Resolves to the sensor when arming completes. Will
         retry updating
         until the tag's data reflect the armed state. Rejects
         with an OperationIncompleteError
         if this is still not the case after the
         default number of retries.
- Type
- Promise
canArm()
Whether the sensor can be armed. Most sensors can be armed but some (such
as signal) cannot.
- Source:
canDisarm()
Whether the sensor can be disarmed. Most sensors that are armed can be
disarmed but some (such as water) cannot.
- Source:
disarm(callbackopt) → {Promise}
Disarms this sensor.
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| callback | module:wirelesstags~apiCallback | <optional> | 
- Source:
Throws:
- 
        if the sensor does not support arming 
Returns:
Resolves to the sensor when disarming completes. Will
         retry updating
         until the tag's data reflect the armed state. Rejects
         with an OperationIncompleteError
         if this is still not the case after the
         default number of retries.
- Type
- Promise
isArmed() → {boolean}
Whether the sensor is armed. An armed sensor will generate notifications upon certain thresholds being exceeded.
- Source:
Returns:
Undefined if the sensor doesn't define an armed state,
           true if it is armed, and false otherwise.
- Type
- boolean
monitoringConfig(newConfigopt) → {MonitoringConfig}
Obtains (or sets) the monitoring configuration
of the sensor.
The monitoring configuration for some sensors is not only stricly about parameters controlling behavior and event notification when armed. For example, for temperature and humidity sensors it includes the unit (°C versus °F, %humidity versus dew point temperature).
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| newConfig | MonitoringConfig | <optional> | on set, the new monitoring configuration object | 
- Source:
Returns:
The monitoring configuration object active
         for this sensor. For sensor objects that haven't been fully
         initialized (see WirelessTag#createSensor), the returned
         object will need to be updated from the cloud
         first before its properties reflect the currently active values.
- Type
- MonitoringConfig
reset(callbackopt) → {Promise}
Resets the motion event status of this sensor. This method is only available for 'event' sensors (which tags with motion, light, PIR, and Reed sensors have).
Parameters:
| Name | Type | Attributes | Description | 
|---|---|---|---|
| callback | module:wirelesstags~apiCallback | <optional> | 
- Source:
Returns:
Resolves when the reset completes.
- Type
- Promise
toString() → {string}
String representation of the sensor object and its data. Includes a
reference to the tag (as name, uuid, and slaveId), properties, and
the sensor's monitoring configuration object.
- Source:
Returns:
- Type
- string