Skip to content
JelinaJelina DocumentationTechnical documentation
Back to website

Historical Queries and Trend Charts

Choose the query method for the purpose: small sets of raw records for troubleshooting, time-bucketed trends for observing changes, and asynchronous export for large data volumes.

Need Method Description
Inspect raw samples Historical details Paginated queries by point and time range
Compare trends Chart query Automatically chooses time buckets and limits returned point count
Custom statistics Aggregate query Specify statistics and time granularity separately for multiple points
Save large record sets Historical export Generates CSV or ZIP in the background

Acquisition, aggregation, and shared history support trend analysis. Specify both device code and dataKey for shared points to avoid mixing identically named points from different devices.

  • Granularity can be selected automatically or specified manually with a time unit and interval.
  • Supported statistics include average, maximum, minimum, count, first, and last; choose according to data type.
  • Time buckets align to the specified time zone for daily or hourly comparisons.
  • Intervals without samples remain null. Charts should display gaps rather than zero.
  • Nonnumeric data is unsuitable for averages; use count, first, or last instead. Display API data warnings alongside the chart.

Analyze cumulative energy readings using the difference between first and last values, accounting for meter resets. Do not sum cumulative readings directly.

POST /ems-data/chart/query, with the login token in the request header:

{
"series": [{"dataKey": "demo_temperature", "statistics": ["AVG", "MAX"]}],
"startTime": "2026-10-01T00:00:00+08:00",
"endTime": "2026-10-02T00:00:00+08:00",
"bucketMode": "AUTO",
"targetPoints": 200,
"timezone": "Asia/Shanghai"
}

The response’s series[].statistics contains each statistical series, alongside the actual bucket interval and warnings. Replace the example point with an actual point on the device.

Use POST /ems-data/history for historical details and POST /ems-data/aggregate/query for custom aggregation. The latter returns individual success or failure results in data.items[]; its response structure is not the same as the chart API’s.

You can also query and analyze with the historical chart Skill. For long-term retention, configure Periodic archiving.