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.

eibdgm - description and tips
#1
Could you explain eibdgm? How to use it?

Based on codes from forum I've prepared such simple script:

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 writehandler(event)
   local dpt, dst = datatypes[ event.dstraw ], event.dst
   if dpt then
     local value = knxdatatype.decode(event.datahex, dpt)
     log(dst, value)
   end
 end
    
 client = eibdgm:new({ timeout = 0.5 })
 client:sethandler('groupwrite', writehandler)
end

-- handle knx
client:step()


So every time when resident script is running clientConfusedtep() is executed.

1) But should I set some os.sleep() between next clientConfusedtep()?
2) How client works internally? Does it has some table with telegrams which appeared but that aren't handled and when they are handled then they are dropped from that table? 3) Could I declare 1 handler to a few events by typing 'groupwrite groupread' etc.?
4) Could I check telegrams not so often like 1s or less but e.g. 1 minute?

PS. This post is also for creating some documentation for forum users, because unfortunately currently there is no such doc.

When I've logged:

Code:
log(client)


Then the result is:

Code:
* table:
[sendpacket]
 * function: 0xb73bd4d8
[sock]
 * udp{unconnected}: 0xb73bd4b8
[handlers]
 * table:
  [1]
   * function: 0xb75e3638


So e.g. I am not see I don't see method clientConfusedtep().

Also I see that when I've set Resident interval to 5s and eibdgm timeout to 5 seconds then telegrams appeared more sooner in Objects than by handler with eibdgm (more sooner than 5 seconds, e.g. 30s).

Is there a possibility that eibdgm could not log all telegrams but only e.g. 1 from 3 which appeared on bus? What is optimum configuration. I know that minimum duration of 1 telegram on TP is 0.05s so how eibdgm works on timeout 0.5s?
Done is better than perfect
Reply
#2
Hi,

You should set resident to 0 seconds, there is no need for a os.sleep(). 

You can set several handlers on different events and execute a function when a specific event occurs (like groupwrite) and perform a action.

BR,

Erwin
Reply
#3
What really means timeout in eibdgm? Because when I've set 0.25 or 5s and Resident with 0s then it seems to work the same. Is bigger value works better when LM CPU has a lot to do?

So Erwin, every step command execute only 1 command, not all from current queue?

You wrote, that there is no need to os.sleep() so is it already used in step() method? Sory for a lot of questions but I want understand really well this topicWink
Done is better than perfect
Reply
#4
Hi,

After timeout the next step is executed, so there is no need to change it without a reason.

Yes every step handles 1 event and based on type of handlers a function may be executed.

BR,

Erwin
Reply


Forum Jump: