Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions pymodbus/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down