(19.11.2015, 07:25)admin Wrote: Right now there's no Lua API for creating scripts and trends. Can you describe what kind of task do you have which requires this functionality?
I would like to be able to select some move sensor in user interface. If a sensor is selected, a script create :
> an event script that sum move's events of the sensor
> a trend to give an historic of the activity
I was thinking about calling the function that create the trend / script in LM interface but call it by script. But I don't know if it could be called by lua.
(19.11.2015, 13:36)admin Wrote: I suggest using a single script attached to object tag, this way you can dynamically add/remove objects. See this doc: http://openrb.com/docs/lua.htm#grp.addtags
You can use LuaSocket http request to create new trend by sending a POST request. I'll provide an example later.
Thank you for your answer, I think I will use the POST request solution.
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)
-- 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)
Hi
Trends do have a limit to make sure you will not eat whole ram. It is around 30MB or something like that. Use lower resolution or shorter period.
BR
This limit was implemented in latest fw I think. In the past there was no limit and we had cases when whole ram was used and device was rebooting all the times. It is around 30MB.
28.02.2018, 12:09 (This post was last modified: 28.02.2018, 12:10 by buuuudzik.)
(28.02.2018, 12:03)Daniel. Wrote: This limit was implemented in latest fw I think. In the past there was no limit and we had cases when whole ram was used and device was rebooting all the times. It is around 30MB.
But this is same on every LM or e.g. power version and Load Balancer has more. Could you check this?
All devices have the same CPU now, in other words all of them are power now. Old and new devices have the same firmware.
We phased out LM BL and you can't buy it anymore. We can generate new fw for them on request.
In some time from now we will have new HW with even faster CPU and double the RAM. This will be nearly the same as LM BL. We could increase limit for trends then.