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:
And this is what I've logged by log(trend, res, err):
OK, I've found that this is from not current firmware. I've found how to do this in current firmware:
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
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