iotthingsboardthingsboard-gateway

export telemetry data of a device in ThingsBoard


im using thingsboard community edition.

i want to know if there is a way to export all time series data of a device into csv or any other file format. i need all the data to analyse it.

thingsboard Professional edition has this feature. but how about Community Edition?


Solution

  • Default csv/xls export is only available in the professional version.

    But you could use the REST api to acquire the historical data.

    My reference below states:

    You can also fetch list of historical values for particular entity type and entity id using GET request to the following URL

    http(s)://host:port/api/plugins/telemetry/{entityType}/{entityId}/values/timeseries?keys=key1,key2,key3&startTs=1479735870785&endTs=1479735871858&interval=60000&limit=100&agg=AVG

    The supported parameters are described below:

    keys - comma separated list of telemetry keys to fetch.

    startTs - unix timestamp that identifies start of the interval in milliseconds.

    endTs - unix timestamp that identifies end of the interval in milliseconds.

    interval - the aggregation interval, in milliseconds.

    agg - the aggregation function. One of MIN, MAX, AVG, SUM, COUNT, NONE.

    limit - the max amount of data points to return or intervals to process.

    ThingsBoard will use startTs, endTs and interval to identify aggregation partitions or sub-queries and execute asynchronous queries to DB that leverage built-in aggregation functions."

    Reference:Thingsboard docs: ts data values api