06.06.2016, 19:26
(This post was last modified: 06.06.2016, 19:31 by Erwin van der Zwart.)
(06.06.2016, 13:19)admin Wrote: You can create an event script which increases object value on each run. Trend will automatically show how many events happened during selected period. You can also get trend data from Lua to display certain stats: http://openrb.com/docs/
Code:value = grp.getvalue('1/1/1')
grp.update('1/1/1', value + 1)
Tip: Use a 12. 4 byte unsigned integer object to have maximum size to count without exponent and also use:
value_reed = event.getvalue()
if value_reed == true then
value = grp.getvalue('1/1/1')
if value >= (256*256*256*256) then -- max of 12. 4 byte unsigned integer object
grp.update('1/1/1', 0) -- reset object value to zero to start counting from start again
else
grp.update('1/1/1', value + 1)
end
end
This makes the counting only happening on opening of the reed otherwise the count will happen on opening and closing, and will make the object value jump to 0 when max of object is reached.
BR,
Erwin