Skip to content

Commit

Permalink
Remove broadcast special handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 20, 2024
1 parent ac5115c commit 01aa40e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
13 changes: 5 additions & 8 deletions pymodbus/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,25 +323,22 @@ class ModbusCountersHandler:
0x0D 3 Return Slave Exception Error Count
Quantity of MODBUS exception error detected by the remote device
since its last restart, clear counters operation, or power-up. It
comprises also the error detected in broadcast messages even if an
exception message is not returned in this case.
since its last restart, clear counters operation, or power-up.
Exception errors are described and listed in "MODBUS Application
Protocol Specification" document.
0xOE 4 Return Slave Message Count
Quantity of messages addressed to the remote device, including
broadcast messages, that the remote device has processed since its
last restart, clear counters operation, or power-up.
Quantity of messages addressed to the remote device that the remote
device has processed since its last restart, clear counters operation,
or power-up.
0x0F 5 Return Slave No Response Count
Quantity of messages received by the remote device for which it
returned no response (neither a normal response nor an exception
response), since its last restart, clear counters operation, or
power-up. Then, this counter counts the number of broadcast
messages it has received.
power-up.
0x10 6 Return Slave NAK Count
Expand Down
8 changes: 4 additions & 4 deletions pymodbus/pdu/diag_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ class ReturnSlaveMessageCountRequest(DiagnosticStatusSimpleRequest):
"""Return slave message count.
The response data field returns the quantity of messages addressed to the
remote device, or broadcast, that the remote device has processed since
remote device, that the remote device has processed since
its last restart, clear counters operation, or power-up
"""

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

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

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

Expand Down
21 changes: 17 additions & 4 deletions test/sub_client/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,27 @@ async def test_client_execute_broadcast():
host="127.0.0.1",
),
)
request = pdu_bit_read.ReadCoilsRequest(1, 1)
request = pdu_bit_read.ReadCoilsRequest(1, 1, slave=0)
transport = MockTransport(base, request)
base.ctx.connection_made(transport=transport)

# with pytest.raises(ModbusIOException):
# assert not await base.async_execute(request)
assert await base.async_execute(False, request)


async def test_client_execute_broadcast_no():
"""Test the client protocol execute method."""
base = ModbusBaseClient(
FramerType.SOCKET,
3,
None,
comm_params=CommParams(
host="127.0.0.1",
),
)
request = pdu_bit_read.ReadCoilsRequest(1, 1, slave=0)
transport = MockTransport(base, request)
base.ctx.connection_made(transport=transport)
assert not await base.async_execute(True, request)

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

0 comments on commit 01aa40e

Please sign in to comment.