ThingsBoard icon

ThingsBoard

Interact with ThingsBoard REST API

Telemetry → Timeseries (Range)

AI-generated

Summary

Fetches historical time series data from ThingsBoard for a specific entity within a time range.

Inputs

  • entityId (required) — A string value representing the entity ID (e.g., a device ID).
  • entityType — The type of entity (e.g., 'DEVICE', 'ASSET'). Defaults to 'DEVICE'.
  • keys (required) — Comma-separated telemetry keys to retrieve.
  • startTs — Start timestamp in milliseconds (UTC). Defaults to 0.
  • endTs — End timestamp in milliseconds (UTC). Defaults to the current time.
  • agg — Aggregation type (e.g., 'AVG', 'MAX', 'MIN', 'SUM', 'COUNT', 'NONE').
  • interval — Interval in milliseconds for aggregation.
  • intervalType — Type of interval (e.g., 'MILLISECONDS', 'WEEK', 'MONTH').
  • timeZone — Timezone for interval types like WEEK or MONTH.
  • orderBy — Sort order: 'ASC' or 'DESC'. Defaults to 'DESC'.
  • limit — Maximum number of results to return (only applies when 'agg' is 'NONE'). Defaults to 50.
  • useStrictDataTypes — If true, prevents automatic conversion of telemetry values to strings.

Output shape

A list of items where each item contains the requested time series data as an object of key-value pairs (timestamp as 'ts' and value).

Data is sorted by timestamp. If aggregation is used, the timestamps reflect the aggregated intervals.

Examples

Example 1: Fetch the last 24 hours of temperature and humidity data for a specific device.

Entity ID: device_uuid, Keys: temperature,humidity, Start Time: (24 hours ago in ms), End Time: (now in ms), Agg: NONE

Example 2: Retrieve the average CPU usage every hour for a device over the past week.

Entity ID: device_uuid, Keys: cpuUsage, Start Time: (1 week ago), End Time: (now), Agg: AVG, Interval Type: HOUR

Links

Discussion