Skip to content

Commit 7e333a4

Browse files
committed
Merge branch 'dev'
2 parents c9fcbad + dc98a13 commit 7e333a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1733
-1098
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
uses: astral-sh/setup-uv@v6
5151
with:
5252
python-version: ${{ matrix.python }}
53-
allow-prereleases: true
5453
enable-cache: true
5554

5655
- name: Create virtualenv and sync dependencies

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Thanks to
4343
- Dries
4444
- duc996
4545
- efdx
46+
- embedded-bed
4647
- Erlend E. Aasland
4748
- Esco441-91
4849
- Farzad Panahi

CHANGELOG.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@ helps make pymodbus a better product.
77

88
:ref:`Authors`: contains a complete list of volunteers have contributed to each major version.
99

10+
11+
Version 3.11.2
12+
--------------
13+
* Clarify documentation on reconnect_delay (#2769)
14+
* Solve CI complaints. (#2766)
15+
* Coverage not allowed below 99.5%. (#2765)
16+
* Test coverage global 100%. (#2764)
17+
* Test coverage simulator 100%. (#2763)
18+
* Test coverage server 100%. (#2760)
19+
* Fix python3.14 deprecation. (#2759)
20+
* Test coverage datastore 100%. (#2757)
21+
* Context test failed due to function code overwritten. (#2758)
22+
* Test coverage transaction 100%. (#2756)
23+
* Test coverage pdu 100%. (#2755)
24+
* Framer test 100%. (#2754)
25+
* llow sub_function_code is custom PDU. (#2753)
26+
* Generate pdu table direct. (#2752)
27+
* Clean pdu lookup in simulator. (#2751)
28+
* diag sub_function_code is 2 bytes. (#2750)
29+
* Requesthandler ignore missing devices logging (#2749)
30+
* Simplify pdu lookup. (#2745)
31+
* Missing coma in string representation of ModbusPDU (#2748)
32+
* Correct "install uv". (#2744)
33+
* Suppress aiohttp missing. (#2743)
34+
* Remove garbage bytes in serial comm. (#2741)
35+
* Test now included python 3.14.
36+
* Stricter types with pyright (#2731)
37+
1038
Version 3.11.1
1139
--------------
1240
* Auto debug in case of an error. (#2738)

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ as well as the
3535
`API_changes <https://github.com/pymodbus-dev/pymodbus/blob/dev/API_changes.rst>`_
3636
files.
3737

38-
Current release is `3.11.1 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.11.1>`_.
38+
Current release is `3.11.2 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.11.2>`_.
3939

4040
Bleeding edge (not released) is `dev <https://github.com/pymodbus-dev/pymodbus/tree/dev>`_.
4141

@@ -69,7 +69,7 @@ Common features
6969
* Very lightweight project
7070
* Requires Python >= 3.10
7171
* Thorough test suite, that test all corners of the library
72-
* Automatically tested on Windows, Linux and MacOS combined with python 3.10 - 3.13
72+
* Automatically tested on Windows, Linux and MacOS combined with python 3.10 - 3.14
7373
* Strongly typed API (py.typed present)
7474

7575
The modbus protocol specification: Modbus_Application_Protocol_V1_1b3.pdf can be found on

doc/source/_static/examples.tgz

261 Bytes
Binary file not shown.

doc/source/_static/examples.zip

259 Bytes
Binary file not shown.

examples/server_hook.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import asyncio
1010
import logging
11+
import sys
1112

1213
from pymodbus import FramerType, pymodbus_apply_logging_config
1314
from pymodbus.datastore import (
@@ -19,6 +20,15 @@
1920
from pymodbus.server import ModbusTcpServer
2021

2122

23+
try:
24+
import helper # type: ignore[import-not-found]
25+
except ImportError:
26+
print("*** ERROR --> THIS EXAMPLE needs the example directory, please see \n\
27+
https://pymodbus.readthedocs.io/en/latest/source/examples.html\n\
28+
for more information.")
29+
sys.exit(-1)
30+
31+
2232
class Manipulator:
2333
"""A Class to run the server."""
2434

@@ -43,8 +53,9 @@ def trace_connect(self, connect: bool) -> None:
4353
txt = "Connected" if connect else "Disconnected"
4454
print(f"---> {txt}")
4555

46-
async def setup(self):
56+
async def setup(self, cmdline):
4757
"""Prepare server."""
58+
args = helper.get_commandline(server=True, description="server hooks", cmdline=cmdline)
4859
pymodbus_apply_logging_config(logging.DEBUG)
4960
datablock = ModbusSequentialDataBlock(0x00, [17] * 100)
5061
context = ModbusServerContext(
@@ -53,11 +64,12 @@ async def setup(self):
5364
),
5465
single=True,
5566
)
67+
address: tuple[str, int] = (args.host if args.host else "", args.port if args.port else 0)
5668
self.server = ModbusTcpServer(
5769
context,
5870
framer=FramerType.SOCKET,
5971
identity=None,
60-
address=("127.0.0.1", 5020),
72+
address=address,
6173
trace_packet=self.trace_packet,
6274
trace_pdu=self.trace_pdu,
6375
trace_connect=self.trace_connect,
@@ -68,10 +80,10 @@ async def run(self):
6880
await self.server.serve_forever()
6981

7082

71-
async def main():
83+
async def main(cmdline=None):
7284
"""Run example."""
7385
server = Manipulator()
74-
await server.setup()
86+
await server.setup(cmdline=cmdline)
7587
await server.run()
7688

7789

examples/server_updating.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ async def updating_task(context):
6363
It should be noted that getValues and setValues are not safe
6464
against concurrent use.
6565
"""
66-
fc_as_hex = 3
66+
func_code = 3
6767
device_id = 0x00
6868
address = 0x10
6969
count = 6
7070

7171
# set values to zero
72-
values = context[device_id].getValues(fc_as_hex, address, count=count)
72+
values = context[device_id].getValues(func_code, address, count=count)
7373
values = [0 for v in values]
74-
context[device_id].setValues(fc_as_hex, address, values)
74+
context[device_id].setValues(func_code, address, values)
7575

7676
txt = (
7777
f"updating_task: started: initialised values: {values!s} at address {address!s}"
@@ -83,9 +83,9 @@ async def updating_task(context):
8383
while True:
8484
await asyncio.sleep(2)
8585

86-
values = context[device_id].getValues(fc_as_hex, address, count=count)
86+
values = context[device_id].getValues(func_code, address, count=count)
8787
values = [v + 1 for v in values]
88-
context[device_id].setValues(fc_as_hex, address, values)
88+
context[device_id].setValues(func_code, address, values)
8989

9090
txt = f"updating_task: incremented values: {values!s} at address {address!s}"
9191
print(txt)

pymodbus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@
2020
from pymodbus.pdu.device import ModbusDeviceIdentification
2121

2222

23-
__version__ = "3.11.1"
23+
__version__ = "3.11.2"
2424
__version_full__ = f"[pymodbus, version {__version__}]"

pymodbus/client/serial.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class AsyncModbusSerialClient(ModbusBaseClient):
3535
:param stopbits: Number of stop bits 1, 1.5, 2.
3636
:param handle_local_echo: Discard local echo from dongle.
3737
:param name: Set communication name, used in logging
38-
:param reconnect_delay: Minimum delay in seconds.milliseconds before reconnecting.
39-
:param reconnect_delay_max: Maximum delay in seconds.milliseconds before reconnecting.
40-
:param timeout: Timeout for connecting and receiving data, in seconds.
38+
:param reconnect_delay: Minimum delay when reconnecting, in seconds (use decimals for milliseconds).
39+
:param reconnect_delay_max: Maximum delay when reconnecting, in seconds (use decimals for milliseconds).
40+
:param timeout: Timeout for connecting and receiving data, in seconds (use decimals for milliseconds).
4141
:param retries: Max number of retries per request.
4242
:param trace_packet: Called with bytestream received/to be sent
4343
:param trace_pdu: Called with PDU received/to be sent

0 commit comments

Comments
 (0)