Skip to content

Return None for broadcast #1987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 9, 2024
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
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