Skip to content

Commit

Permalink
Return None for broadcast. (#1987)
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Feb 9, 2024
1 parent 7f469d5 commit a4184f1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async def async_execute(self, request=None) -> ModbusResponse:
if not count or not self.no_resend_on_retry:
self.transport_send(packet)
if self.broadcast_enable and not request.slave_id:
resp = b"Broadcast write sent - no response expected"
resp = None
break
try:
resp = await asyncio.wait_for(
Expand Down
3 changes: 1 addition & 2 deletions test/sub_client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,7 @@ async def test_client_execute_broadcast():
transport = MockTransport(base, request)
base.connection_made(transport=transport)

response = await base.async_execute(request)
assert response == b'Broadcast write sent - no response expected'
assert not await base.async_execute(request)

async def test_client_protocol_retry():
"""Test the client protocol execute method with retries."""
Expand Down

0 comments on commit a4184f1

Please sign in to comment.