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
#1
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.
Reply
#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
#3
Thanks a lot. It's difficult to find and understand how to do this but now I see.
Reply
#4
How can I use the objects in the grp.update ?

For example with a 14byte ASCII string with the value of the object.id + objectlog.ASCII + logtime

grp.update ('32/2/2', 'Event: ' .. object.id .. objectlog.ASCII .. logtime )
KNX Advanced Partner + Tutor
Reply
#5
What kind of task do you have? If you display only one log entry you will get the same result as showing current object value.
Reply


Forum Jump: