Class: WirelessTagSensor

WirelessTagSensor(tag, sensorType)

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 Not Monitoring or Disarmed, whereas armed sensors can be in Normal, Too Hot, Too Dry, and other states, depending on the type of sensor. Not every sensor has an event state; for example, the signal sensor does not. (Nor does the motion sensor, because it would be redundant with the event sensor.)

eventStateValues Array.<string>

the possible values for eventState

probeType string

only for temperature (temp, secondarytemp), humidity, and moisture sensors, the type of measurement probe or mechanism. Typically Internal, but can be DS18B20 and Thermocouple for temperature, and BLDXXXX for moisture/humidity sensors, respectively, of tags capable of using an alternative probe.

probeDisconnected boolean

true if an external probe is detected as disconnected, false if it is detected as connected, and undefined (or not present as a property) if the connection status can't be detected (or if the tag doesn't support external probes).

gracePeriod number

only for outofrange sensors, the grace period in seconds after which a tag will go into Out Of Range state after losing contact with the tag manager.

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

Type
WirelessTagPlatform.OperationUnsupportedError
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

Type
WirelessTagPlatform.OperationUnsupportedError
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