DT Developer Docs
REST APIDT StudioStatus Page
  • Getting Started
  • Overview
  • Concepts
    • Devices
    • Events
    • Topics
      • Temperature Measurement Interval
      • Motion Sensor Activity Timer
  • Data Connectors
    • Introduction to Data Connectors
    • Creating a Data Connector
    • Configuring a Data Connector
    • Receiving Events
    • Best Practices
    • Example Integrations
      • Heroku
      • Google Cloud Functions
      • AWS Lambda
      • Azure HTTP Triggers
      • IBM Cloud Actions
    • Development Guides
      • Local Development with ngrok
  • REST API
  • Introduction to REST API
  • Explore Our Endpoints
    • with cURL
    • with Python API
    • with Postman
  • Authentication
    • OAuth2
    • Basic Auth
  • Error Codes
  • Emulator API
  • Examples
    • Pagination
    • Streaming Events
    • Touch to Identify
    • Refreshing Access Token
  • Reference
  • Status Page
  • Service Accounts
    • Introduction to Service Accounts
    • Creating a Service Account
    • Managing Access Rights
    • Permissions
    • Organizational Structures
  • Other
    • Application Notes
      • Generating a Room Temperature Heatmap
      • Modeling Fridge Content Temperatures
      • Outlier Detection on Multiple Temperature Sensors
      • Simple Temperature Forecasting for Substation Transformers
      • Sensor Data Insight with Power BI and Azure
      • Third-Party Sensor Data in DT Cloud
    • Frequently Asked Question
Powered by GitBook
On this page
  • Overview
  • Configuring Sampling Interval
  • Measurement Timeline
  • Concatenating Historic Events
  • Publishing Emulated Events
  • Sample Timestamp Accuracy

Was this helpful?

  1. Concepts
  2. Topics

Temperature Measurement Interval

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

Last updated 1 year ago

Was this helpful?

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

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

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

Publishing Emulated Events

dt.Emulator.publish_event(
    device_id="<YOUR_DEVICE_ID>",
    project_id="<YOUR_PROJECT_ID>",
    data=dt.events.Temperature(
        timestamp=datetime.utcnow(),
        celsius=22.3,
        samples=[
            dt.events.TemperatureSample(
                celsius=22.3,
                timestamp=datetime.utcnow(),
            ),
            dt.events.TemperatureSample(
                celsius=22.8,
                timestamp=datetime.utcnow()-timedelta(seconds=30),
            ),
            dt.events.TemperatureSample(
                celsius=23.3,
                timestamp=datetime.utcnow()-timedelta(seconds=60),
            ),
        ],
    )
)

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.

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 , the first element in the list is equal to the event timestamp and value, independent of configuration.

A 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 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 .

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

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

The method is available under the Emulator resource of our Python API. The following snippet shows an overview, and a full implementation example can be found .

here
Emulator API
DT Studio
publish_event()
here
listing temperature events
Sensor Configuration in Studio for a 2nd and 3rd Generation Temperature Sensor
How events for the 2nd and 3rd Generation Temperature Sensor are scheduled.
Temperature Event documentation
Temperature Event