09.08.2022, 11:34
(09.08.2022, 11:30)admin Wrote: "Connection refused" means that either your slave script is not running or it's not using port 502. The test script is a master that checks if a local slave is running or not.
I use your previous script, that I run. Then I run your test script.
Did I make a mistake ?
Code:
if not mb then
require('luamodbus')
mb = luamodbus.tcp()
mb:open('0.0.0.0', 502)
mb:setslave(2)
function setint64(grpaddr, regaddr)
local value = grp.getvalue(grpaddr) or 0
local raw = knxdatatype.encode(value, dt.int64).dataraw
local r1 = raw:byte(2) * 0x100 + raw:byte(1)
local r2 = raw:byte(4) * 0x100 + raw:byte(3)
local r3 = raw:byte(6) * 0x100 + raw:byte(5)
local r4 = raw:byte(8) * 0x100 + raw:byte(7)
mb:setregisters(regaddr, r4, r3, r2, r1)
end
function updateregisters()
setint64('32/1/1', 3204)
end