Telemetry Data
Telemetry data is data collected from remote data points such as sensors or BMS equipment and comes as time series data (meaning usually a series of readings with timestamps for when the readings were taken). The Item Service provides a way to manage your sensors in a NamedTelemetryCollection which is backed by a special time series type of collection created for managing timestamped readings data.
To understand how to manage Telemetry data in the Item Service you need to understand three things.
NamedTelemetryCollections#
The first step to managing telemetry data is to create NamedTelemetryCollections to contain the items which represent your sensors or IOT devices. You can create NamedTelemetryCollections as best suit you, but one good way is to create one NamedTelemetryCollection per type of sensor.
When you create a NamedTelemetryCollection you do so much as you create a NamedUserCollection. However, with NamedTelemetryCollections you will also provide some time series data such as the granularity of the readings that you will be managing for the sensors in the collection.
You will need to select either 'seconds', 'minutes', or 'hours'.
When deciding how you will create NamedTelemetryCollections it is good to consider the reading granularity, and to keep sensors that have different reading granularities in different collections.
Telemetry Items#
Telemetry Items represent sensors or IOT devices. Creating Telemetry Items is very similar to creating other items in the item service.
Telemetry Items have an additional requirement however. Each Telemetry Item must contain a _sourceId. This _sourceId is the id of the sensor or IOT device in the external system. This _sourceId is important as it will be used when we create readings for the sensors.
Readings#
When adding sensor readings, you always add them to the Telemetry Items in a NamedTelemetryCollection. As such, reading items have some additional requirements.
Reading objects must have:
_ts: a timestamp value for the reading
_tsMetadata._telItemId: the _id of the Telemetry Item the reading is for (the sensor _id)
_tsMetadata._sourceId: the _sourceId of the Telemetry Item the reading is for (the sensor _sourceId)
All the rest of the data on a reading is up to you based on the type of reading you are creating.
Hands On#
- Download INT06 - Item Service Telemetry.zip and extract it to your disk
- Open 'INT06 - Telemetry Data.mjs' in your IDE
- Follow the steps in the file