Logic Machine Forum
Log - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Log (/showthread.php?tid=2433)



Log - zuuper - 23.01.2020

Hi,

Is it possible to log every event to a MS SQL -db? If not, to a mySQL db? 
Is there a sample code for this, I can't find anything ?

BR,
Alexander


RE: Log - Daniel - 23.01.2020

https://forum.logicmachine.net/showthread.php?tid=193&pid=798#pid798


RE: Log - zuuper - 23.01.2020

Okey, mysql can work, good : But MSSQL ?
But to get all write-to-bus-message we need a handle-func?

I have test with:

if not client then
  require('genohm-scada.eibdgm')

  objects = grp.all()
  datatypes = {}

  for _, object in ipairs(objects) do
    datatypes[ object.id ] = object.datatype
  end

  function writehandler(event)
    log('FUNC:' .. event)

    local dpt = datatypes[ event.dstraw ]
    if dpt then
      local value = knxdatatype.decode(event.datahex, dpt)
    end
  end

  function readhandler(event)
    log('FUNC:' .. event)
  end

  client = eibdgm:new({ timeout = 1 })
  clientConfusedethandler('groupwrite', writehandler)
  clientConfusedethandler('groupresponse', writehandler)
clientConfusedethandler('groupread', readhandler)
end

-- handle knx
clientConfusedtep()

But it will not work ..

When I, from ETS, use write to, my handler cant feel it..


RE: Log - admin - 23.01.2020

Native MSSQL is not supported. You can use Web Services API in SQL Server to implement data exchange.

For group monitoring you need a resident script with sleep time set to 0. log('FUNC:' .. event) is incorrect, use log('FUNC', event)