It works, but if I make a script like this there is 5-10 delay of sending KNX address (in if statement) after UDP string is sent by the client:
I use this code as resident with 0s interval.
Any thoughts of making this script work faster?
Nevermind! I solved it by putting logic in "if data then" statement
I use this code as resident with 0s interval.
Any thoughts of making this script work faster?
Code:
if not server then
require('socket')
server = socket.udp()
server:setsockname('*', 8891)
server:settimeout(1)
end
data = server:receive()
local TerminalID = string.byte(data, 9, 12)
local FingerID = string.byte(data, 33, 36)
if (FingerID == 6 and TerminalID == 63) then
grp.write('4/0/10', 1)
elseif (FingerID == 7 and TerminalID == 63) then
grp.write('0/5/18', 0)
end
Nevermind! I solved it by putting logic in "if data then" statement