Hi everyone,
I’m using OpenHAB with a dual-interface server. The main network is 192.168.1.0/24
, and the Modbus devices are on a separate subnet 10.42.42.0/24
.
The OpenHAB server has access to both networks — the primary IP is 192.168.1.1
.
I’m using the Modbus binding to connect to a device at 10.42.42.2:1502
, but I keep getting connection timeouts.
> 2025-04-13 17:48:54.016 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Connect reached max tries 1, throwing last error: Connect timed out. Connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/10.42.42.2, m_Port=1502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@dfd160c, m_ConnectTimeoutMillis=10000, rtuEncoded=false]. Endpoint ModbusIPSlaveEndpoint [address=10.42.42.2, port=1502]
> 2025-04-13 17:48:54.016 [WARN ] [ing.ModbusSlaveConnectionFactoryImpl] - Error connecting connection TCPMasterConnection [m_Socket=Socket[unconnected], m_Timeout=3000, m_Connected=false, m_Address=/10.42.42.2, m_Port=1502, m_ModbusTransport=net.wimpi.modbus.io.ModbusTCPTransport@dfd160c, m_ConnectTimeoutMillis=10000, rtuEncoded=false] for endpoint ModbusIPSlaveEndpoint [address=10.42.42.2, port=1502]: Connect timed out
> 2025-04-13 17:48:54.016 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Could not connect to endpoint ModbusIPSlaveEndpoint [address=10.42.42.2, port=1502] -- aborting request ModbusReadRequestBlueprint [slaveId=71, functionCode=READ_MULTIPLE_REGISTERS, start=56, length=1, maxTries=3] [operation ID 0b227963-c7d8-44f5-b070-026df8cfc5bb]
The Port is open an Ping is working. Is there a way to force the Modbus binding to use the second interface (e.g. via localAddress
) or any other idea why the connection might fail?
Thanks in advance!