From a4184f1e760587bfc2c822ac149261f043c64ea8 Mon Sep 17 00:00:00 2001 From: jan iversen Date: Fri, 9 Feb 2024 12:38:39 +0100 Subject: [PATCH] Return None for broadcast. (#1987) --- pymodbus/client/base.py | 2 +- test/sub_client/test_client.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pymodbus/client/base.py b/pymodbus/client/base.py index e0772cf5c..2cd9270da 100644 --- a/pymodbus/client/base.py +++ b/pymodbus/client/base.py @@ -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( diff --git a/test/sub_client/test_client.py b/test/sub_client/test_client.py index a75ba1bc7..298fb41e6 100755 --- a/test/sub_client/test_client.py +++ b/test/sub_client/test_client.py @@ -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."""