(09.04.2017, 16:49)Bitver Wrote: Hi,
How is it possible to make a page with raw list of 30 day log of certain objects?
e.g. I need to log 20 binary inputs (1bit objects) and show them somehow.
Thanks.
Here you have a lua script for getting from db logs from last 30 days only for specified objects:
Code:
objects = "Object name 1', 'Object name 2" -- comma separated names of objects
query = "SELECT objectlog.id, objectlog.datahex, src, logtime FROM objects, objectlog WHERE objectlog.address=objects.id
AND name IN('" .. objects .. "') AND logtime>=" .. os.microtime()-30*24*3600 .. " LIMIT 30"
logs = db:getall(query)
The result is a table with such data:
- objectlog.id - id in objectlogs
- objectlog.datahex - data in datahex("01" for true and "00" for false for binary)
- src - sender address also in hex
- logtime - timestamp of log
This data you can:
1) write to some object only for visualisation purposes via grp.update() with filter if necessary
or
2) or you can write a simple .lp file with mixed HTML + Lua which generate divs with above data. Then you can add this simple site to your visualisation.
Type ".lp file" in search input on this forum to see some information about this function.
For start you can check this post:
http://forum.logicmachine.net/showthread.php?tid=85