This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Problem with Trend API
#1
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).

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)
Reply
#2
Trends API is mostly low-level stuff, so you can either get data at selected trend resolution or daily data. Everything else must be converted manually.
Reply


Forum Jump: