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.

localbus
#1
hi , i am trying to work with localbus but i don't receive any logs from the groupcallback  function, i want to monitor several obj in a resident script.
in the attached i can see the handlers table but also udp{unconnected} maybe this is my problem ??

Code:
lb = require('localbus').new()

lb:sethandler('groupwrite', groupcallback)
lb:sethandler('groupread', groupcallback)
lb:sethandler('groupresponse', groupcallback)

log(lb)

function groupcallback(event) 
 
  log(event)
 
  if event.dst == '0/2/1' then   
    local value = knxdatatype.decode(event.datahex, dt.uint16)   
    log(value)
   
  end
end
many thanks

Attached Files Image(s)
   
Reply
#2
Hi!
Does script engine gives you any errors?

Check that on error log...
Reply
#3
You need to call step for it to receive data. You should also define callback before setting it.
Code:
if not lb then
  lb = require('localbus').new(1)

  function groupcallback(event)  
    log(event)
    
    if event.dst == '0/2/1' then    
      local value = knxdatatype.decode(event.datahex, dt.uint16)    
      log(value)
    end
  end

  lb:sethandler('groupwrite', groupcallback)
  lb:sethandler('groupread', groupcallback)
  lb:sethandler('groupresponse', groupcallback)
end

lb:step()
Reply
#4
(31.07.2020, 08:35)admin Wrote: You need to call step for it to receive data. You should also define callback before setting it.
Code:
if not lb then
  lb = require('localbus').new(1)

  function groupcallback(event) 
    log(event)
   
    if event.dst == '0/2/1' then   
      local value = knxdatatype.decode(event.datahex, dt.uint16)   
      log(value)
    end
  end

  lb:sethandler('groupwrite', groupcallback)
  lb:sethandler('groupread', groupcallback)
  lb:sethandler('groupresponse', groupcallback)
end

lb:step()
Many Thanks Smile
Reply


Forum Jump: