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.

How create scripts and trends by script ?
#8
How to change it to other values? I want create trend with below parameters:
Trend resolution: 5 minutes
Resolution data: 1 year
Daily data: 2 years

This is the part of my script which has error 302:

Code:
trend = {      object = knxlib.encodega(object), -- object id in db      name = alias, -- trend name      type = 'G',      precision = 2,      count_minutely = 365*24*60,      count_hourly = 2*24*365,      count_daily = 5*365    }

And this is what I've logged by log(trend, res, err):

Code:
* arg: 1  * table:   [object]    * number: 66048   [count_daily]    * number: 1825   [count_minutely]    * number: 525600   [type]    * string: G   [precision]    * number: 2   [name]    * string: PEGO_Goscinna - Room humidity   [count_hourly]    * number: 17520 * arg: 2  * string: <html> <head><title>302 Found</title></head> <body bgcolor="white"> <center><h1>302 Found</h1></center> <hr><center>nginx</center> </body> </html> * arg: 3  * number: 302
OK, I've found that this is from not current firmware. I've found how to do this in current firmware:
Code:
require('json') require('socket.url') require('socket.http') -- parameters daily = 365*24*60 -- 1 day daily1year = 365*24*12 -- 365 day daily2year = 2*365*24*12 -- 365 day year5_d = 5*365 -- 5 year object = grp.alias('Kitchen_Temperature')     trend = {  object = knxlib.encodega(object), -- object id in db  name = alias, -- trend name  type = trend_type,  resolution = 5, -- every 5 minute  precision = 2, -- floating point precision  count_resolution = 365*24*12, -- 1 year  count_daily = 5*365 -- 5 years } data = json.encode(trend) post = 'data=' .. socket.url.escape(data)          res, err = socket.http.request('http://admin:admin@127.0.0.1/scada-main/trends/save', post) log(res, err)
Done is better than perfect
Reply


Messages In This Thread
RE: How create scripts and trends by script ? - by buuuudzik - 28.02.2018, 10:03

Forum Jump: