Logic Machine Forum
Log all packets from 15.15.* - 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 all packets from 15.15.* (/showthread.php?tid=3677)



Log all packets from 15.15.* - kgroenhoej - 10.11.2021

Hi

Is there any easy way to log all packets coming from source 15.15.* ? (without making a tag on all objects)
I have some units that use 15.15.* when they are starting up and after a while change the address to the right configured address. And I want to log if these units have any other strange behavior.

Thanks

Regards
Klaus


RE: Log all packets from 15.15.* - buuuudzik - 10.11.2021

Hi Klaus,

you could use such script and customize handleLog function according to your needs.


Code:
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 handleLog(src, eventType, ga, value, rawEvent)
    local isLoggedAddress = src:find("15.15.%d+") ~= nil
    if isLoggedAddress then
      log(src, eventType, ga, value, os.time())
    end
  end

  function writehandler(event)
    local dpt, dst = datatypes[ event.dstraw ], event.dst
    local value = nil
   
    if dpt then
      value = knxdatatype.decode(event.datahex, dpt)
    end
   
    handleLog(event.src, event.type, dst, value, event)
  end
   
  client = eibdgm:new({ timeout = 0.5 })
  client:sethandler('groupwrite', writehandler)
end

-- handle knx
client:step()


You could look also into these posts:
https://forum.logicmachine.net/showthread.php?tid=1592&highlight=eibdgm
https://forum.logicmachine.net/showthread.php?tid=2620&highlight=eibdgm


RE: Log all packets from 15.15.* - kgroenhoej - 10.11.2021

It did the job - thanks

Smile


RE: Log all packets from 15.15.* - buuuudzik - 11.11.2021

Awesome!