thingsboard / thingsboard

Open-source IoT Platform - Device management, data collection, processing and visualization.
https://thingsboard.io
Apache License 2.0
17.63k stars 5.21k forks source link

[Question] Timeseries API #9575

Closed psxbox closed 10 months ago

psxbox commented 1 year ago

Hello! I would like to create my own report. I need to get time series with aggregation. In RestApi /api/plugins/telemetry/{entityType}/{entityId}/values/timeseries{?agg,endTs,interval,keys,limit,orderBy,startTs,useStrictDataTypes} has the interval parameter. If we want the aggregation interval range to be one day, we will set it to 86400000. How to set this option to one month? The months are different. Thanks.

mykhailokornieiev commented 1 year ago

Hi. There is no such option in Thingsboard Rest API. Such functionality is only available on the UI side as a front-end feature, and it takes different interval parameters (ts) depending on which month is it (28, 30 or 31 days). For your case, it would be necessary to set up this interval for each month individually

psxbox commented 1 year ago
Time Активная энергия Рективная энергия
08/11/2023 17:30:00 0,000 0,000
08/11/2023 18:30:00 0,049 0,009
08/11/2023 19:30:00 0,047 0,009
08/11/2023 20:30:00 0,036 0,006
08/11/2023 21:30:00 0,032 0,005
08/11/2023 22:30:00 0,014 0,002
08/11/2023 23:30:00 0,007 0,000

... 09/11/2023 17:30:00 | 0,054 | 0,010

Why, when aggregating data by interval, is the time displayed in the middle of each interval?

mykhailokornieiev commented 1 year ago

In fact, this is simply by design of the aggregation function. For the day, it will be noon, for the hour - hh:30. etc. But the actual calculation for the 17:30 (for example) has timeframe between 17:00 and 18:00, as you mentioned before So, it's just by design of Thingsboard.

Ultrazombie commented 10 months ago

Closed due to inactive