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 ?
#6
Here's an example for creating trends, don't forget to set admin password in socket.http.request:


Code:
require('json') require('socket.url') require('socket.http') object = '1/1/1' trend = {  object = knxlib.encodega(object),  name = 'New trend', -- trend name  type = 'C', -- C is counter, D is counter with neg. delta, G is absolute value  precision = 2, -- floating point precision  count_minutely = 24 * 60, -- 1 day  count_hourly = 24 * 365, -- 1 year  count_daily = 365, -- 1 year } data = json.encode(trend) post = 'data=' .. socket.url.escape(data) res, err = socket.http.request('http://admin:admin@127.0.0.1/cgi-bin/scada/general/request.cgi?_module=trends&_action=save', post) log(res, err)
Reply


Messages In This Thread
RE: How create scripts and trends by script ? - by admin - 20.11.2015, 11:16

Forum Jump: