Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen committed Oct 9, 2024
2 parents dcbcfd7 + a165c7a commit b34fa5e
Show file tree
Hide file tree
Showing 88 changed files with 997 additions and 3,095 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
- dev
- master
- wait_next_API
- dev_*
tags:
- v*
pull_request:
branches:
- dev
- wait_next_api
types: [opened, synchronize, reopened, ready_for_review]
schedule:
# Sunday at 02:10 UTC.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clean_workflow_runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
console.log("About to clear")
Expand Down
5 changes: 5 additions & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Thanks to
- Alexander Lanin
- Alexandre CUER
- Alois Hockenschlohe
- Andy Walker
- Arjan
- André Srinivasan
- andrew-harness
Expand All @@ -27,6 +28,7 @@ Thanks to
- Chandler Riehm
- Chris Hung
- Christian Krause
- Daniel Rauber
- dhoomakethu
- doelki
- DominicDataP
Expand Down Expand Up @@ -64,6 +66,8 @@ Thanks to
- Logan Gunthorpe
- Marko Luther
- Matthias Straka
- Matthias Urlichs
- Michel F
- Mickaël Schoentgen
- Pavel Kostromitinov
- peufeu2
Expand All @@ -77,6 +81,7 @@ Thanks to
- Totally a booplicate
- WouterTuinstra
- wriswith
- Yash Jani
- Yohrog
- yyokusa

Expand Down
38 changes: 38 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,44 @@ helps make pymodbus a better product.

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

Version 3.7.3
-------------
* 100% test coverage of framers (#2359)
* Framer, final touches. (#2360)
* Readme file renamed (#2357)
* Remove old framers (#2358)
* frameProcessIncomingPacket removed (#2355)
* Cleanup framers (reduce old_framers) (#2342)
* Run CI on PR targeted at wait_next_api.
* Sync client, allow unknown recv msg size. (#2353)
* integrate old rtu framer in new framer (#2344)
* Update README.rst (#2351)
* Client.close should not allow reconnect= (#2347)
* Remove async client.idle_time(). (#2349)
* Client doc, add common methods (base). (#2348)
* Reset receive buffer with send(). (#2343)
* Remove unused protocol_id from pdu (#2340)
* CI run on demand on non-protected branches. (#2339)
* Server listener and client connections have is_server set. (#2338)
* Reopen listener in server if disconnected. (#2337)
* Regroup test. (#2335)
* Improve docs around sync clients and reconnection (#2321)
* transport 100% test coverage (again) (#2333)
* Update actions to new node.js. (#2332)
* Bump 3rd party (#2331)
* Documentation on_connect_callback (#2324)
* Fixes the unexpected implementation of the ModbusSerialClient.connected property (#2327)
* Forward error responses instead of timing out. (#2329)
* Add `stacklevel=2` to logging functions (#2330)
* Fix encoding & decoding of ReadFileRecordResponse (#2319)
* Improvements for example/contib/solar (#2318)
* Update solar.py (#2316)
* Remove double conversion in int (#2315)
* Complete pull request #2310 (#2312)
* fixed type hints for write_register and write_registers (#2309)
* Remove _header from framers. (#2305)


Version 3.7.2
-------------
* Correct README
Expand Down
6 changes: 3 additions & 3 deletions MAKE_RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Prepare/make release on dev.
* Control / Update API_changes.rst
* Update CHANGELOG.rst
* Add commits from last release, but selectively !
git log --oneline v3.7.0..HEAD > commit.log
git log --pretty="%an" v3.7.0..HEAD | sort -uf > authors.log
git log --oneline v3.7.3..HEAD > commit.log
git log --pretty="%an" v3.7.3..HEAD | sort -uf > authors.log
update AUTHORS.rst and CHANGELOG.rst
cd doc; ./build_html
* rm -rf build/* dist/*
Expand Down Expand Up @@ -58,4 +58,4 @@ Architecture documentation.
------------------------------------------------------------
* install graphviz
* pyreverse -k -o jpg pymodbus
l
l
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Upgrade examples:
- 3.6.1 -> 3.7.0: Smaller changes to the pymodbus calls might be needed
- 2.5.4 -> 3.0.0: Major changes in the application might be needed

Current release is `3.7.2 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.7.2>`_.
Current release is `3.7.3 <https://github.com/pymodbus-dev/pymodbus/releases/tag/v3.7.3>`_.

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

Expand Down Expand Up @@ -84,7 +84,7 @@ Server Features
* callback to intercept requests/responses
* work on RS485 in parallel with other devices

`Server documentation <https://pymodbus.readthedocs.io/en/latest/source/library/server.html>`_
`Server documentation <https://pymodbus.readthedocs.io/en/latest/source/server.html>`_


REPL Features
Expand Down
File renamed without changes.
Binary file modified doc/source/_static/examples.tgz
Binary file not shown.
Binary file modified doc/source/_static/examples.zip
Binary file not shown.
42 changes: 36 additions & 6 deletions doc/source/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ Pymodbus offers clients with transport different protocols and different framers
- ASCII
- RTU
- RTU_OVER_TCP
- Socket
- SOCKET
- TLS
* - Serial (RS-485)
* - SERIAL (RS-485)
- Yes
- Yes
- No
Expand Down Expand Up @@ -118,19 +118,32 @@ that a device have received the packet.
Client usage
------------
Using pymodbus client to set/get information from a device (server)
is done in a few simple steps, like the following synchronous example::
is done in a few simple steps.

Synchronous example
^^^^^^^^^^^^^^^^^^^

::

from pymodbus.client import ModbusTcpClient

client = ModbusTcpClient('MyDevice.lan') # Create client object
client.connect() # connect to device, reconnect automatically
client.connect() # connect to device
client.write_coil(1, True, slave=1) # set information in device
result = client.read_coils(2, 3, slave=1) # get information from device
print(result.bits[0]) # use information
client.close() # Disconnect device

The line :mod:`client.connect()` connects to the device (or comm port). If this cannot connect successfully within
the timeout it throws an exception. After this initial connection, further
calls to the same client (here, :mod:`client.write_coil(...)` and
:mod:`client.read_coils(...)` ) will check whether the client is still
connected, and automatically reconnect if not.

and a asynchronous example::
Asynchronous example
^^^^^^^^^^^^^^^^^^^^

::

from pymodbus.client import AsyncModbusTcpClient

Expand All @@ -141,7 +154,7 @@ and a asynchronous example::
print(result.bits[0]) # use information
client.close() # Disconnect device

The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object it does not activate
The line :mod:`client = AsyncModbusTcpClient('MyDevice.lan')` only creates the object; it does not activate
anything.

The line :mod:`await client.connect()` connects to the device (or comm port), if this cannot connect successfully within
Expand All @@ -153,6 +166,9 @@ The line :mod:`result = await client.read_coils(2, 3, slave=1)` is an example of

The last line :mod:`client.close()` closes the connection and render the object inactive.

Development notes
^^^^^^^^^^^^^^^^^

Large parts of the implementation are shared between the different classes,
to ensure high stability and efficient maintenance.

Expand Down Expand Up @@ -232,6 +248,20 @@ There are a client class for each type of communication and for asynchronous/syn
- :mod:`AsyncModbusUdpClient`
- :mod:`ModbusUdpClient`

Client common
^^^^^^^^^^^^^
Some methods are common to all client:

.. autoclass:: pymodbus.client.base.ModbusBaseClient
:members:
:member-order: bysource
:show-inheritance:

.. autoclass:: pymodbus.client.base.ModbusBaseSyncClient
:members:
:member-order: bysource
:show-inheritance:

Client serial
^^^^^^^^^^^^^
.. autoclass:: pymodbus.client.AsyncModbusSerialClient
Expand Down
16 changes: 8 additions & 8 deletions doc/source/library/framer.rst
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
Framer
======

pymodbus\.framer\.ModbusAsciiFramer module
pymodbus\.framer\.FramerAscii module
------------------------------------------

.. automodule:: pymodbus.framer.ModbusAsciiFramer
.. automodule:: pymodbus.framer.FramerAscii
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.ModbusRtuFramer module
pymodbus\.framer\.FramerRTU module
----------------------------------------

.. automodule:: pymodbus.framer.ModbusRtuFramer
.. automodule:: pymodbus.framer.FramerRTU
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.ModbusSocketFramer module
pymodbus\.framer\.FramerSocket module
-------------------------------------------

.. automodule:: pymodbus.framer.ModbusSocketFramer
.. automodule:: pymodbus.framer.FramerSocket
:members:
:undoc-members:
:show-inheritance:

pymodbus\.framer\.ModbusTlsFramer module
pymodbus\.framer\.FramerTLS module
----------------------------------------

.. automodule:: pymodbus.framer.ModbusTlsFramer
.. automodule:: pymodbus.framer.FramerTLS
:members:
:undoc-members:
:show-inheritance:
8 changes: 4 additions & 4 deletions doc/source/library/simulator/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ The entry “comm” allows the following values:

The entry “framer” allows the following values:

- “ascii” to use :class:`pymodbus.framer.ModbusAsciiFramer`,
- “rtu” to use :class:`pymodbus.framer.ModbusRtuFramer`,
- “tls” to use :class:`pymodbus.framer.ModbusTlsFramer`,
- “socket” to use :class:`pymodbus.framer.ModbusSocketFramer`.
- “ascii” to use :class:`pymodbus.framer.FramerAscii`,
- “rtu” to use :class:`pymodbus.framer.FramerRTU`,
- “socket” to use :class:`pymodbus.framer.FramerSocket`.
- “tls” to use :class:`pymodbus.framer.FramerTLS`,

Optional entry "device_id" will limit server to only accept a single id. If
not set, the server will accept all device id.
Expand Down
2 changes: 1 addition & 1 deletion examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def setup_async_client(description=None, cmdline=None):
client = modbusClient.AsyncModbusSerialClient(
args.port,
# Common optional parameters:
# framer=ModbusRtuFramer,
# framer=FramerType.RTU,
timeout=args.timeout,
# retries=3,
# Serial setup parameters
Expand Down
12 changes: 6 additions & 6 deletions examples/client_custom_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class CustomModbusResponse(ModbusResponse):
function_code = 55
_rtu_byte_count_pos = 2

def __init__(self, values=None, slave=1, transaction=0, protocol=0, skip_encode=False):
def __init__(self, values=None, slave=1, transaction=0, skip_encode=False):
"""Initialize."""
ModbusResponse.__init__(self, slave, transaction, protocol, skip_encode)
ModbusResponse.__init__(self, slave, transaction, skip_encode)
self.values = values or []

def encode(self):
Expand Down Expand Up @@ -68,9 +68,9 @@ class CustomModbusRequest(ModbusRequest):
function_code = 55
_rtu_frame_size = 8

def __init__(self, address=None, slave=1, transaction=0, protocol=0, skip_encode=False):
def __init__(self, address=None, slave=1, transaction=0, skip_encode=False):
"""Initialize."""
ModbusRequest.__init__(self, slave, transaction, protocol, skip_encode)
ModbusRequest.__init__(self, slave, transaction, skip_encode)
self.address = address
self.count = 16

Expand Down Expand Up @@ -100,12 +100,12 @@ def execute(self, context):
class Read16CoilsRequest(ReadCoilsRequest):
"""Read 16 coils in one request."""

def __init__(self, address, count=None, slave=1, transaction=0, protocol=0, skip_encode=False):
def __init__(self, address, count=None, slave=1, transaction=0, skip_encode=False):
"""Initialize a new instance.
:param address: The address to start reading from
"""
ReadCoilsRequest.__init__(self, address, count=16, slave=slave, transaction=transaction, protocol=protocol, skip_encode=skip_encode)
ReadCoilsRequest.__init__(self, address, count=16, slave=slave, transaction=transaction, skip_encode=skip_encode)


# --------------------------------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion examples/client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def setup_sync_client(description=None, cmdline=None):
client = modbusClient.ModbusSerialClient(
port=args.port, # serial port
# Common optional parameters:
# framer=ModbusRtuFramer,
# framer=FramerType.RTU,
timeout=args.timeout,
# retries=3,
# Serial setup parameters
Expand Down
Loading

0 comments on commit b34fa5e

Please sign in to comment.