22.07.2024, 05:27
Try this:
Code:
if not tcp then
tcp, err = lutron_login()
if not tcp then
log('no connection to device', err)
os.sleep(5)
end
end
while tcp do
res, err = lutron_receive(tcp)
if res then
log(res)
elseif err == 'closed' then
tcp:close()
tcp = nil
end
end