I am logging several values in the objectlogs tab. When I try to export them I get the following error in a new safari-tab: Error: /lib/genohm-scada/web/objectlogs/csv.lua:10: unexpected symbol near '=' Any ideas how to resolve this? Thanks, Bart
Not sure, but it looks like you are using special sign in you object names and that might cause a error in the CSV notation.. are you using ' or '' signs or , in your object names?
(11.03.2017, 22:51)Erwin van der Zwart Wrote: Hi Bart,
Not sure, but it looks like you are using special sign in you object names and that might cause a error in the CSV notation.. are you using ' or '' signs or , in your object names?
BR,
Erwin
Hi Erwin,
Only minus-sign nothing else.
I have attached a screendump.
Mvg, Bart
(12.03.2017, 10:22)admin Wrote: It's a bug in the FW, we will fix it in the next release.
Hi Admin,
Any ideas how to get a logfile (csv) for a set of grpadresses?
I would need a 2 day logging of the weatherstation since it is giving wrong values (it is currently more than 50 degrees C in Belgium according to the station ) - need to send it to the supplier.
Best regards,
Bart
13.03.2017, 22:46 (This post was last modified: 13.03.2017, 22:47 by Erwin van der Zwart.)
Hi Bart,
This script creates a csv of the object logs on your ftp folder:
Code:
-- get past year data
logtime = os.time() - 60 * 60 * 24 * 365
-- list of objects by id
objects = {}
-- objects with logging enabled
query = 'SELECT address, datatype, name FROM objects WHERE disablelog=0'
for _, object in ipairs(db:getall(query)) do
objects[ tonumber(object.address) ] = {
datatype = tonumber(object.datatype),
name = tostring(object.name or ''),
}
end
-- get object logs
query = 'SELECT src, address, datahex, logtime, eventtype FROM objectlog WHERE logtime >= ? ORDER BY id DESC'
for _, row in ipairs(db:getall(query, logtime)) do
object = objects[ tonumber(row.address) ]
-- found matching object and event type is group write
if object and row.eventtype == 'write' then
datatype = object.datatype
-- check that object datatype is set
if datatype then
-- decode data
data = knxdatatype.decode(row.datahex, datatype)
-- remove null chars from char/string datatype
if datatype == dt.char or datatype == dt.string then
data = data:gsub('%z+', '')
-- date to DD.MM.YYYY
elseif datatype == dt.date then
data = string.format('%.2d.%.2d.%.2d', data.day, data.month, data.year)
-- time to HH:MM:SS
elseif datatype == dt.time then
data = string.format('%.2d:%.2d:%.2d', data.hour, data.minute, data.second)
end
else
data = ''
end
(13.03.2017, 22:46)Erwin van der Zwart Wrote: Hi Bart,
This script creates a csv of the object logs on your ftp folder:
Code:
-- get past year data
logtime = os.time() - 60 * 60 * 24 * 365
-- list of objects by id
objects = {}
-- objects with logging enabled
query = 'SELECT address, datatype, name FROM objects WHERE disablelog=0'
for _, object in ipairs(db:getall(query)) do
objects[ tonumber(object.address) ] = {
datatype = tonumber(object.datatype),
name = tostring(object.name or ''),
}
end
-- get object logs
query = 'SELECT src, address, datahex, logtime, eventtype FROM objectlog WHERE logtime >= ? ORDER BY id DESC'
for _, row in ipairs(db:getall(query, logtime)) do
object = objects[ tonumber(row.address) ]
-- found matching object and event type is group write
if object and row.eventtype == 'write' then
datatype = object.datatype
-- check that object datatype is set
if datatype then
-- decode data
data = knxdatatype.decode(row.datahex, datatype)
-- remove null chars from char/string datatype
if datatype == dt.char or datatype == dt.string then
data = data:gsub('%z+', '')
-- date to DD.MM.YYYY
elseif datatype == dt.date then
data = string.format('%.2d.%.2d.%.2d', data.day, data.month, data.year)
-- time to HH:MM:SS
elseif datatype == dt.time then
data = string.format('%.2d:%.2d:%.2d', data.hour, data.minute, data.second)
end
else
data = ''
end
This only work if I have objects, and if objects are mark as log.
If I want to get all traffic in knx without mark the log field, because there is some knx device that i have not control over it, and it send me each time some unknown data, that I have not in the object table.
I just want to send all trafic on KNX bus each 1 hour, even if I have not objects created in my LM5. Could it be posible???
You could try to enable auto object creation in the general settings and set the log policy to all objects.
This way there will be a object created when the telegram holds a valid KNX structure and the logging will be activated already because you log all objects including the new ones..