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.

Logs in visualization
#2
(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
Reply


Messages In This Thread
Logs in visualization - by Bitver - 09.04.2017, 16:49
RE: Logs in visualization - by buuuudzik - 10.04.2017, 07:48
RE: Logs in visualization - by Bitver - 03.05.2017, 10:59
RE: Logs in visualization - by toujour - 19.02.2019, 09:14
RE: Logs in visualization - by admin - 19.02.2019, 09:19

Forum Jump: