LogicMachine Forum
Multi-proxy modbus connection - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Multi-proxy modbus connection (/showthread.php?tid=5608)



Multi-proxy modbus connection - gianluca_depascali@hotmail.it - 09.09.2024

Hi everybody!

I have a problem about modbus writing.
In this work there is two airconditioning connected to modbus and it have the same modbus ID (49). I can't change it because the company don't allow it.
I connected this two device to the two different port of RS485.
But the problem is to open comunication with proxy. You can't specificate where it have to open comunication. 
I use this script:
Code:
-- get value of object with group address 1/1/1 setpoint_z2 = grp.getvalue('1/1/1') setpoint_z2_mb = setpoint_z2*2 -- proxy works only when RTU is enabled in Modbus settings mb = require('mbproxy').new() mb:setslave(49) -- set register at address 6 mb:writeregisters(6, setpoint_z2_mb) -- read from address 6 value_rmb = mb:readregisters(6)



RE: Multi-proxy modbus connection - admin - 09.09.2024

You can pass the RTU port number (1, 2 or 3) when creating a proxy connection like this:
Code:
require('mbproxy').new(2) -- use RTU 2

Make sure to configure and enable both ports in RTU settings.