diff --git a/pymodbus/transaction.py b/pymodbus/transaction.py index 796ca95ed..a28d7c5a8 100644 --- a/pymodbus/transaction.py +++ b/pymodbus/transaction.py @@ -310,10 +310,7 @@ def _transact(self, packet, response_length, full=False, broadcast=False): 'to "WAITING FOR REPLY"' ) self.client.state = ModbusTransactionState.WAITING_FOR_REPLY - if ( - hasattr(self.client, "handle_local_echo") - and self.client.handle_local_echo is True - ): + if self.client.comm_params.handle_local_echo is True: if self._recv(size, full) != packet: return b"", "Wrong local echo" result = self._recv(response_length, full) diff --git a/test/test_transaction.py b/test/test_transaction.py index abf0b01a6..2dfbcca8b 100755 --- a/test/test_transaction.py +++ b/test/test_transaction.py @@ -163,11 +163,11 @@ def test_execute(self, mock_time): trans._recv = mock.MagicMock( # pylint: disable=protected-access side_effect=iter([b"abcdef", b"deadbe", b"123456"]) ) - client.handle_local_echo = True + client.comm_params.handle_local_echo = True trans.retry_on_empty = False trans.retry_on_invalid = False assert trans.execute(request).message == "[Input/Output] Wrong local echo" - client.handle_local_echo = False + client.comm_params.handle_local_echo = False # retry on invalid response trans.retry_on_invalid = True