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.

HDL Buspro gateway integration with LM5
#12
Try this:
Code:
if not sock then
  require('user.hdl')

  sock = socket.udp()
  sock:settimeout(60)
  sock:setsockname('*', 6000)

  HDL.init()
end

data = sock:receive()
if data then
  packet, err = HDL.decode(data)

  if packet then
    if packet.opcode == HDL.cmd.chanregreply then
      channel, _, value = packet.additional:byte(1, 3)
      
      if channel == 1 then
        grp.checkupdate('1/1/1', value)
      elseif chanel == 2 then
        grp.checkupdate('1/1/2', value)
      elseif chanel == 3 then
        grp.checkupdate('1/1/3', value)
      elseif chanel == 4 then
        grp.checkupdate('1/1/4', value)
      end        
    end

    -- packet.additional = lmcore.strtohex(packet.additional)
    -- log('HDL packet', packet)
  else
    log('HDL error', err)
  end
end

If you have multiple HDL relay devices then you need to check packet.srcdevice value to determine the status group address.
Reply


Messages In This Thread
RE: HDL Buspro gateway integration with LM5 - by admin - 25.06.2025, 07:44

Forum Jump: