Temperature Measurement Interval

A quick showcase on how to interact with the sampling interval of the 2nd and 3rd generation temperature sensors.

Overview

The 2nd and 3rd Generation Wireless Temperature Sensor both supports configuring a sampling interval that is shorter than the heartbeat interval. This enables the temperature sensor to measure the temperature as often as every 30 seconds, with only a minor impact on battery life. Like our 1st generation sensors, an event is generated every periodic heartbeat, but with the 2nd and 3rd generation hardware, the event can contain up to 30 temperature samples, depending on the configuration.

Configuring Sampling Interval

The sampling interval can be configured from Studio in the Sensor Configuration section of the device details page.

API support for device configuration is coming later.

Measurement Timeline

When the sensor is configured to sample more than 1 sample per heartbeat, additional samples are included with every temperature event as a list of timestamps and values. As shown in the Temperature Event documentation, the first element in the list is equal to the event timestamp and value, independent of configuration.

If more than 1 sample has been sampled during the period, the list is in decreasing order, meaning that the oldest sample is located at the end. The total length of the list will depend on the configuration.

Concatenating Historic Events

A Temperature Event has a samples field that will always include all the measured values since the previous heartbeat. This makes it easier to create a single sorted list of all the samples when listing temperature events through the API.

The following snippet shows how to unpack a list of historic temperature events fetched using our Python API. A full example can be found here.

samples = []
for event in events:
    samples += event.data.samples

Publishing Emulated Events

Temperature events from the 2nd and 3rd Generation Wireless Temperature Sensor can be generated without access to physical sensors using the Emulator API.

In DT Studio, click API Integrations -> Emulator, then select or create a temperature sensor. When selecting Emulate sampling between heartbeats, the feature appears.

Sample Timestamp Accuracy

Normally, the updateTime of an event is set to when the Cloud Connector receives the event from the sensor. Since this is not possible for samples between heartbeats, the timestamp of these samples is estimated by DT Cloud.

The implementation of this estimation assumes an ideally distributed interval according to the configuration. For example, if the sensor is configured to 5 samples per heartbeat and it has been exactly 10 minutes since the previous heartbeat, the interval between the timestamps will be exactly 2 minutes.

Last updated