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 whether you accept or reject these cookies being set.

How to read logs with javascript
Hi guys,

I would like to read from logs: data, time, group address and value.
I want to use an iFrame with an HTML page that display those datas as the customer wants Wink

Nobody can help me?? Confused
You should prepare .lp file in/user/ location(e.g. logs.lp) and inside you must prepare in lua such script:

-- How much objects do you need?
objects_number = 10

query = "SELECT ol.logtime,, ol.datahex, o.datatype, ol.eventtype FROM objectlog AS ol, objects AS o WHERE ol.address=o.address AND ol.eventtype IN ('write', 'response') ORDER BY ol.logtime DESC LIMIT " .. objects_number
result = db:getall(query)

logs = {}

for _,row in ipairs(result) do  
    logs[_] = {logtime ='%Y.%m.%d %H:%M:%S', row.logtime), name =, value = knxdatatype.decode(row.datahex, row.datatype)}

logs = json.encode(logs)


And when you will have this file you can use it in js by:
$.get( "/user/logs.lp", function( data ) {
   res = data.trim();
   res = JSON.parse(res);
// further operating with data in javascript ;)
Or maybe better for you would be to prepare all html, js and lua in this .lp file Wink
Thank you buuuudzik! Big Grin
You're welcome and good luck with your projectWink

Forum Jump: