![]() |
|
Modbus help - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Modbus help (/showthread.php?tid=6402) |
Modbus help - nisan - 22.04.2026 When using LM5 for Modbus communication, if the resident script queries the register status while the event script is writing to the register, it may not be possible to write to the register. How can this be better resolved? RE: Modbus help - admin - 22.04.2026 Use profiles. RE: Modbus help - nisan - 22.04.2026 (22.04.2026, 09:36)admin Wrote: Use profiles. Are there any examples for reference? RE: Modbus help - admin - 22.04.2026 Profiler app: https://forum.logicmachine.net/showthread.php?tid=5911 Profile reference: https://kb.logicmachine.net/misc/modbus-profile/ Profile examples: https://forum.logicmachine.net/showthread.php?tid=839 RE: Modbus help - nisan - 28.04.2026 I use a JSON file to map MODBUS. At first, I couldn't actively read it; it could only automatically send values to KNX when they changed. Is there any solution? RE: Modbus help - admin - 28.04.2026 What do you mean by "actively read it"? In Modbus device settings you specify poll interval - all registers that are mapped to group addresses will be read every X seconds. Mapped group address values will be updated if the Modbus value differs from the current value. RE: Modbus help - nisan - 08.07.2026 (22.04.2026, 09:42)admin Wrote: Profiler app: https://forum.logicmachine.net/showthread.php?tid=5911 Hello, I’m currently working on a project that requires connecting multiple Modbus device systems. I plan to use a gateway to transmit JSON scripts for each system via the TCP protocol, yet I’m quite worried this may lead to excessive communication load. Is this concern justified? RE: Modbus help - admin - 08.07.2026 You can specify poll interval for each Modbus device. This value controls how often all Modbus datapoints that are mapped to group addresses are read. Increasing the poll interval lowers the overall system load. "Value send delta" option should be configured correctly for all registers. Increasing this value reduces the number of object writes. RE: Modbus help - nisan - 09.07.2026 RE: Modbus help - admin - 09.07.2026 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()RE: Modbus help - nisan - 09.07.2026 (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. 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? RE: Modbus help - admin - 09.07.2026 Use mbproxy for RS485 communication. Enable and configure RTU1 in Modbus tab. Then use this in scripts: https://forum.logicmachine.net/showthread.php?tid=6118&pid=39898#pid39898 |