09.07.2026, 07:01
(09.07.2026, 06:40)admin Wrote: If you need to change the unit number dynamically then you should use scripts with a single write of multiple registers. The Modbus device might only handle a small number of parallel TCP connections which leads to communication issues.
Try logging the result of connect/write:
Code:mb = require('luamodbus').tcp() mb:open('192.168.1.1', 502) res, err = mb:connect() if res then res, err = mb:writeregisters(1, 2, 3) if not res then log('write failed', err) end else log('connection failed', err) end mb:close()
The air conditioner communicates via the gateway's 485 interface using wired communication. Currently, I have placed the register reading in the resident script and the register writing in the event script. There has been a problem with communication conflicts between the event script and the resident script during use, causing the event script not to execute actions. Is there a good solution for this?