I'm using the REST-API endpoint of the 'getTimeseris' function to aggregate telemetry data over a time period of about 2 years.
Data is guaranteed to be present within the whole range of this period.
However, for some combinations of startTs end endTs the API-call returns an empty object.
Example:
start_date = '2019-11-03T00:00:00.00Z'
=> startTs = 1572739200000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query = .../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572739200000&endTs=1635638400000
response with status code 200 = {}
Example 2: shift the start_date by 1 day into the future while end_date remains the same
start_date = '2019-11-04T00:00:00.00Z'
=> startTs = 1572825600000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query = .../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572825600000&endTs=1635638400000
response with status code 200 = {'Temperature': [{'ts': 1604360600000, 'value': '23.154'}]}
Example 3: shift the start_date by 1 day into the past while end_date remains the same
start_date = '2019-11-02T00:00:00.00Z'
=> startTs = 1572652800000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query = .../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572652800000&endTs=1635638400000
response with status code 200 = {'Temperature': [{'ts': 1604187800000, 'value': '23.153'}]}
At first I though that the first example doesn't work because the timedelta between startTs and endTs is slightly less than the aggregation interval (62848800000 ms vs 63070000000 ms).
But the same is true for the other two examples and it still works.
So what am I doing wrong?
Whats so special about this exact combination of startTs and endTs?
Any suggestions?
Server Environment
- own setup
- docker deployment
- ThingsBoard Version: 3.3.1 PE
- Win 10
I'm using the REST-API endpoint of the 'getTimeseris' function to aggregate telemetry data over a time period of about 2 years.
Data is guaranteed to be present within the whole range of this period.
However, for some combinations of startTs end endTs the API-call returns an empty object.
Example:
start_date = '2019-11-03T00:00:00.00Z'
=> startTs = 1572739200000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query =
.../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572739200000&endTs=1635638400000response with status code 200 = {}
Example 2: shift the start_date by 1 day into the future while end_date remains the same
start_date = '2019-11-04T00:00:00.00Z'
=> startTs = 1572825600000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query =
.../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572825600000&endTs=1635638400000response with status code 200 = {'Temperature': [{'ts': 1604360600000, 'value': '23.154'}]}
Example 3: shift the start_date by 1 day into the past while end_date remains the same
start_date = '2019-11-02T00:00:00.00Z'
=> startTs = 1572652800000
end_date = '2021-10-31T00:00:00.00'
=> endTs = 1635638400000
query =
.../api/plugins/telemetry/DEVICE/someDeviceID/values/timeseries?interval=63070000000&agg=AVG&useStrictDataTypes=false&keys=Temperature&startTs=1572652800000&endTs=1635638400000response with status code 200 = {'Temperature': [{'ts': 1604187800000, 'value': '23.153'}]}
At first I though that the first example doesn't work because the timedelta between startTs and endTs is slightly less than the aggregation interval (62848800000 ms vs 63070000000 ms).
But the same is true for the other two examples and it still works.
So what am I doing wrong?
Whats so special about this exact combination of startTs and endTs?
Any suggestions?
Server Environment