Skip to content

IoT TS Aggregates Client for Node.js

NOTE: This version is Deprecated. Please use tsaggregates V4 (4.2.0) sdk

Introduction

The IoT TS Aggregates Node.js client allows you to query aggregated time series data. Refer to IoT TS Aggregates for more information about the service.

Further implementation of the TS Aggregate SDK library has been shown in a sample project that you can download and test in local or on Insights Hub application. Please refer to this repository: industrial-iot-node-sdk-examples

Hint

In the IoT context, assets are referred to as entity and aspects as propertyset.
Placeholders in the following samples are indicated by angle brackets < >.

TS Aggregates operations

Client name: AggregatesClient

Read aggregated time series

Read aggregated time series data of a specific asset and aspect. This feature is only available if aspect data is available within the specified time range.

Note

A query can only return up to 200 aggregate intervals in one response.
Aggregates can only be created from up to 5,000 raw time series entries.

// Import the mindsphere-sdk-node-core module and require AppCredentials and ClientConfig
let AppCredentials = require('mindsphere-sdk-node-core').AppCredentials;
let ClientConfig = require('mindsphere-sdk-node-core').ClientConfig;

// Import the timeseriesaggregate module and require AggregatesClient
const AggregatesClient = require('tsaggregates-sdk').AggregatesClient;

// Construct the ClientConfig and AppCredentials objects
let config = new ClientConfig();
let credentials = new AppCredentials();

// Construct the AggregatesClient object
let aggregates_client = new AggregatesClient(config, credentials);

try {

  const request_object = {
    entity: <entity_id>,
    propertyset : <property_set>,
    from: <from_date>,
    to: <to_date>,
    intervalValue: <interval_length>,
    intervalUnit: <interval_unit>,
    select: <select>
  };

  let aggregates_data = await aggregates_client.getAggregateTimeseries(request_object);

} catch (ex) {
  // Exception handling
}

Last update: February 23, 2024

Except where otherwise noted, content on this site is licensed under the Development License Agreement.