14.01.2017, 16:00
I want use trends for energy calculation last day, last month, last year.
Probably I've found a bug in a firmware 20160927 or I don't understand well this API.
Trend 'Light' has resolution 10 minutes. I want receive table with 24 x 1-hour data, but by this script I receive only table with 144 keys(every 10 minutes). The other situation is when I use only 86400 then I receive 1 value. When I use 86400/2 or 86400/4 or other there is everytime table with 144 keys(every 10 minutes).
Probably I've found a bug in a firmware 20160927 or I don't understand well this API.
Trend 'Light' has resolution 10 minutes. I want receive table with 24 x 1-hour data, but by this script I receive only table with 144 keys(every 10 minutes). The other situation is when I use only 86400 then I receive 1 value. When I use 86400/2 or 86400/4 or other there is everytime table with 144 keys(every 10 minutes).
Code:
require('trends')
name = 'Light'
dates = {}
dates['start'] = { year = 2017, month = 1, day = 12}
dates['end'] = { year = 2017, month = 1, day = 13}
-- resolution (in seconds) is optional
-- default trend resolution is used when not set
resolution = 3600 -- hourly data
res = trends.fetch(name, dates, resolution)
log(res)