Observations

An observation is the primary data unit of the Control Center. When a payload is received from a device, it is transformed by a Transformer into an Observation. The Control Center can then visualize these observations on configured dashboards, as well as show them on the Observations page.

This page serves as a reference for both viewing observation data, as well as managing Observation Types.

Viewing Observations

To view recorded observations, select Observations from the left-hand navigation.

A map view will now appear, showing all provisioned devices at their configured coordinates. If an Observation Type is properly configured, it will automatically show the latest observation for a given device.

Note the view selection controls in the top right corner of the map. These can be used to switch between a map view (default), as well as a more data-driven list view.

You can also click on a given device’s icon, which will show a history of its latest observations as well as metadata about the device.

Observation Type View Format

When creating and editing observation types, you can specify a view that defines metadata that the Control Center uses when displaying observations.

This should be defined as anonymous function that has two parameters and returns a JS object as described in the following tables.

Parameters

The following parameters are provided to the function:

Pos Name Description
1 endDevice The end device model
2 observation The observation that should be processed. This contains a data field consisting of the JS object produced by the transformer.

Return

A JS object must be returned, with the following fields:

Field Description
fields An object whose keys correspond to a field of the observation, and values are JS objects (see following table).
observationsMapValue A string indicating the field to associate with the map view’s value indication.
observationsMapGauge A string indicating the field to associate with the map view’s gauge indication.

Each field in the above object should be a JS object that defines the following fields:

Field Description
value A number containing the numeric representation of the field.
name A string containing the name of the field.
text A string containing the formatted value for the field, e.g. with units
color A string equal to one of: danger, warning, success.
scaleMin A number describing the lower value bound for the field.
scaleMax A number describing the upper value bound for the field.

Example

The following is an example view function that processes the provided observation to assign a color, and returns the field listing and mapping.

function(endDevice, latestObservation) {
  var color;

  if (latestObservation.data.voltage >= 5) {
    color = 'success';
  } else if (latestObservation.data.voltage >= 3) {
    color = 'warning';
  } else {
    color = 'danger';
  }

  return {
    observationsMapValue: 'voltage',
    observationsMapGauge: 'voltage',
    fields: {
      voltage: {
        value: latestObservation.data.voltage,
        name: 'Voltage',
        text: latestObservation.data.voltage.toFixed(1) + ' kV',
        color: color,
        scaleMin: 0,
        scaleMax: 6
      }
    }
  };
}

Creating an Observation Type

To create an observation type, follow the steps below:

  1. Select Settings from the left-hand navigation.
  2. Select Observation Types from the section navigation.
  3. Select New from the right-hand part of the page.
  4. A form will now appear prompting for the topic, name, secret path, and view. The topic describes where transformed values should be stored, and the secret path specifies the secret that each observation should be encrypted with. Be sure to refer to the section above for information on writing a view function.
  5. Select Save. The observation type should now appear in the listing.

Editing an Observation Type

To edit an observation type, follow the steps below:

  1. Select Settings from the left-hand navigation.
  2. Select Observation Types from the section navigation.
  3. Find the observation type you wish to modify, and select its row. Alternatively, you can select the gear icon, followed by Edit.
  4. Modify the form as required.
  5. Select Save.

Removing an Observation Type

To remove an observation type, follow the steps below:

  1. Select Settings from the left-hand navigation.
  2. Select Observation Types from the section navigation.
  3. Find the observation type you wish to delete, and select the gear icon, followed by Delete. The observation type should now be removed from the listing.