Skip to content

Commit 5be871e

Browse files
committed
Revert "ExceptionResponse for no_response_expected."
This reverts commit c03741c.
1 parent c03741c commit 5be871e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

examples/client_async_calls.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,7 @@ async def async_execute_diagnostic_requests(client):
268268
assert not rr.isError() # test that call was OK
269269
rr = await client.diag_force_listen_only(device_id=DEVICE_ID, no_response_expected=True)
270270
assert rr.isError() # test that call was OK, error indicate no response
271-
assert not rr.dev_id
272-
assert rr.exception_code == -1
271+
273272

274273
# ------------------------
275274
# Run the calls in groups.

pymodbus/transaction/transaction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def sync_execute(self, no_response_expected: bool, request: ModbusPDU) -> Modbus
127127
while count_retries <= self.retries:
128128
self.pdu_send(request)
129129
if no_response_expected:
130-
return ExceptionResponse(request.function_code, device_id=0, exception_code=-1)
130+
return ExceptionResponse(0xff)
131131
try:
132132
response = self.sync_get_response(request.dev_id, request.transaction_id)
133133
if response.dev_id != request.dev_id:
@@ -170,7 +170,7 @@ async def execute(self, no_response_expected: bool, request: ModbusPDU) -> Modbu
170170
self.response_future = asyncio.Future()
171171
self.pdu_send(request)
172172
if no_response_expected:
173-
return ExceptionResponse(request.function_code, device_id=0, exception_code=-1)
173+
return ExceptionResponse(0xff)
174174
try:
175175
response = await asyncio.wait_for(
176176
self.response_future, timeout=self.comm_params.timeout_connect

0 commit comments

Comments
 (0)