The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Terms of Use and Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content
Insights Hub and Industrial IoT

Insights Hub drives smart manufacturing through the industrial Internet of Things. Gain actionable insights with asset and operational data and improve your processes.

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
}