Skip to content

Commit 01aa40e

Browse files
committed
Remove broadcast special handling.
1 parent ac5115c commit 01aa40e

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

pymodbus/device.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,25 +323,22 @@ class ModbusCountersHandler:
323323
0x0D 3 Return Slave Exception Error Count
324324
325325
Quantity of MODBUS exception error detected by the remote device
326-
since its last restart, clear counters operation, or power-up. It
327-
comprises also the error detected in broadcast messages even if an
328-
exception message is not returned in this case.
326+
since its last restart, clear counters operation, or power-up.
329327
Exception errors are described and listed in "MODBUS Application
330328
Protocol Specification" document.
331329
332330
0xOE 4 Return Slave Message Count
333331
334-
Quantity of messages addressed to the remote device, including
335-
broadcast messages, that the remote device has processed since its
336-
last restart, clear counters operation, or power-up.
332+
Quantity of messages addressed to the remote device that the remote
333+
device has processed since its last restart, clear counters operation,
334+
or power-up.
337335
338336
0x0F 5 Return Slave No Response Count
339337
340338
Quantity of messages received by the remote device for which it
341339
returned no response (neither a normal response nor an exception
342340
response), since its last restart, clear counters operation, or
343-
power-up. Then, this counter counts the number of broadcast
344-
messages it has received.
341+
power-up.
345342
346343
0x10 6 Return Slave NAK Count
347344

pymodbus/pdu/diag_message.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ class ReturnSlaveMessageCountRequest(DiagnosticStatusSimpleRequest):
534534
"""Return slave message count.
535535
536536
The response data field returns the quantity of messages addressed to the
537-
remote device, or broadcast, that the remote device has processed since
537+
remote device, that the remote device has processed since
538538
its last restart, clear counters operation, or power-up
539539
"""
540540

@@ -553,7 +553,7 @@ class ReturnSlaveMessageCountResponse(DiagnosticStatusSimpleResponse):
553553
"""Return slave message count.
554554
555555
The response data field returns the quantity of messages addressed to the
556-
remote device, or broadcast, that the remote device has processed since
556+
remote device, that the remote device has processed since
557557
its last restart, clear counters operation, or power-up
558558
"""
559559

@@ -567,7 +567,7 @@ class ReturnSlaveNoResponseCountRequest(DiagnosticStatusSimpleRequest):
567567
"""Return slave no response.
568568
569569
The response data field returns the quantity of messages addressed to the
570-
remote device, or broadcast, that the remote device has processed since
570+
remote device, that the remote device has processed since
571571
its last restart, clear counters operation, or power-up
572572
"""
573573

@@ -586,7 +586,7 @@ class ReturnSlaveNoResponseCountResponse(DiagnosticStatusSimpleResponse):
586586
"""Return slave no response.
587587
588588
The response data field returns the quantity of messages addressed to the
589-
remote device, or broadcast, that the remote device has processed since
589+
remote device, that the remote device has processed since
590590
its last restart, clear counters operation, or power-up
591591
"""
592592

test/sub_client/test_client.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,27 @@ async def test_client_execute_broadcast():
432432
host="127.0.0.1",
433433
),
434434
)
435-
request = pdu_bit_read.ReadCoilsRequest(1, 1)
435+
request = pdu_bit_read.ReadCoilsRequest(1, 1, slave=0)
436436
transport = MockTransport(base, request)
437437
base.ctx.connection_made(transport=transport)
438-
439-
# with pytest.raises(ModbusIOException):
440-
# assert not await base.async_execute(request)
441438
assert await base.async_execute(False, request)
442439

440+
441+
async def test_client_execute_broadcast_no():
442+
"""Test the client protocol execute method."""
443+
base = ModbusBaseClient(
444+
FramerType.SOCKET,
445+
3,
446+
None,
447+
comm_params=CommParams(
448+
host="127.0.0.1",
449+
),
450+
)
451+
request = pdu_bit_read.ReadCoilsRequest(1, 1, slave=0)
452+
transport = MockTransport(base, request)
453+
base.ctx.connection_made(transport=transport)
454+
assert not await base.async_execute(True, request)
455+
443456
async def test_client_protocol_retry():
444457
"""Test the client protocol execute method with retries."""
445458
base = ModbusBaseClient(

0 commit comments

Comments
 (0)