From c04c20acba211010be1ea00583729778a93bafa8 Mon Sep 17 00:00:00 2001 From: Matthias Krebs Date: Mon, 10 Nov 2025 14:09:03 +0100 Subject: [PATCH 1/5] added pyserial to pymodbus dependency. --- commhandler/CHANGELOG.md | 7 +++++++ commhandler/pyproject.toml | 2 +- commhandler/requirements.txt | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/commhandler/CHANGELOG.md b/commhandler/CHANGELOG.md index d8de98f..2732867 100644 --- a/commhandler/CHANGELOG.md +++ b/commhandler/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [unreleased] + +### Fixed + +- include `pyserial` in required dependencies, fixes error when serial device is created + + ## [0.5.0] - 2025-10-27 ### Added diff --git a/commhandler/pyproject.toml b/commhandler/pyproject.toml index adfe53e..d583057 100644 --- a/commhandler/pyproject.toml +++ b/commhandler/pyproject.toml @@ -21,7 +21,7 @@ dependencies = [ "jmespath>=1.0.0,<2.0.0", "jsonata-python>=0.6.0,<1.0.0", "parsel>=1.10.0,<1.11.0", - "pymodbus>=3.7.0,<3.8.0", + "pymodbus[serial]>=3.7.0,<3.8.0", "gmqtt>=0.7.0,<1.0.0", "xsdata>=25.0.0,<26.0.0", "xmlschema>=4.1.0,<5.0.0", diff --git a/commhandler/requirements.txt b/commhandler/requirements.txt index f26bc79..464077d 100644 --- a/commhandler/requirements.txt +++ b/commhandler/requirements.txt @@ -2,7 +2,7 @@ Jinja2>=3.1.0,<4.0.0 jmespath>=1.0.0,<2.0.0 jsonata-python>=0.6.0,<1.0.0 parsel>=1.10.0,<1.11.0 -pymodbus>=3.7.0,<3.8.0 +pymodbus[serial]>=3.7.0,<3.8.0 gmqtt>=0.7.0,<1.0.0 xsdata>=25.0.0,<26.0.0 xmlschema>=4.1.0,<5.0.0 From c0a38d2943c76c35ef7f145c9ae7de6e7b7a160b Mon Sep 17 00:00:00 2001 From: Matthias Krebs Date: Wed, 17 Dec 2025 17:50:14 +0100 Subject: [PATCH 2/5] fixed Modbus byte/word order. --- commhandler/CHANGELOG.md | 1 + .../sgr_commhandler/driver/modbus/modbus_client_async.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/commhandler/CHANGELOG.md b/commhandler/CHANGELOG.md index 2732867..4d1c7da 100644 --- a/commhandler/CHANGELOG.md +++ b/commhandler/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - include `pyserial` in required dependencies, fixes error when serial device is created +- configure Modbus byte/word order according to SGr specification ## [0.5.0] - 2025-10-27 diff --git a/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py b/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py index 622c5af..29d4ac7 100644 --- a/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py +++ b/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py @@ -30,9 +30,10 @@ def __init__(self, endianness: BitOrder, addr_offset: int, client: ModbusBaseCli self._lock = threading.Lock() self._client: ModbusBaseClient = client self._byte_order: Endian = ( - Endian.BIG - if endianness is None or endianness == BitOrder.BIG_ENDIAN - else Endian.LITTLE + Endian.LITTLE + if endianness + in {BitOrder.CHANGE_BYTE_ORDER, BitOrder.CHANGE_BIT_ORDER} + else Endian.BIG ) self._word_order: Endian = ( Endian.LITTLE From fd6b1ade3ff503692597b195dc92eaeb2c5df707 Mon Sep 17 00:00:00 2001 From: Matthias Krebs Date: Wed, 17 Dec 2025 18:35:39 +0100 Subject: [PATCH 3/5] updated minimal dependency versions, maintain compatibility with Python 3.9. --- commhandler/CHANGELOG.md | 4 ++++ commhandler/pyproject.toml | 16 ++++++++-------- commhandler/requirements-dev.txt | 4 ++-- commhandler/requirements-doc.txt | 6 +++--- commhandler/requirements.txt | 16 ++++++++-------- 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/commhandler/CHANGELOG.md b/commhandler/CHANGELOG.md index 4d1c7da..c27d6fc 100644 --- a/commhandler/CHANGELOG.md +++ b/commhandler/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## Changed + +- updated minimal dependency versions, maintain Python 3.9 compatibility + ### Fixed - include `pyserial` in required dependencies, fixes error when serial device is created diff --git a/commhandler/pyproject.toml b/commhandler/pyproject.toml index d583057..982c52c 100644 --- a/commhandler/pyproject.toml +++ b/commhandler/pyproject.toml @@ -17,17 +17,17 @@ maintainers = [ { name = "Matthias Krebs" } ] dependencies = [ - "Jinja2>=3.1.0,<4.0.0", - "jmespath>=1.0.0,<2.0.0", + "Jinja2>=3.1.6,<4.0.0", + "jmespath>=1.0.1,<2.0.0", "jsonata-python>=0.6.0,<1.0.0", "parsel>=1.10.0,<1.11.0", - "pymodbus[serial]>=3.7.0,<3.8.0", + "pymodbus[serial]>=3.7.4,<3.8.0", "gmqtt>=0.7.0,<1.0.0", - "xsdata>=25.0.0,<26.0.0", - "xmlschema>=4.1.0,<5.0.0", - "aiohttp>=3.12.0,<4.0.0", - "certifi", - "cachetools>=6.2.0,<7.0.0", + "xsdata>=25.7.0,<26.0.0", + "xmlschema>=4.2.0,<5.0.0", + "aiohttp>=3.13.2,<4.0.0", + "certifi>=25.11.12", + "cachetools>=6.2.4,<7.0.0", "sgr-specification>=2.2.0,<3.0.0" ] diff --git a/commhandler/requirements-dev.txt b/commhandler/requirements-dev.txt index 74785c0..7cc448e 100644 --- a/commhandler/requirements-dev.txt +++ b/commhandler/requirements-dev.txt @@ -1,2 +1,2 @@ -pytest>=8.4.0,<9.0.0 -pytest-asyncio>=1.0.0,<2.0.0 +pytest>=8.4.2,<9.0.0 +pytest-asyncio>=1.1.1,<1.2.0 diff --git a/commhandler/requirements-doc.txt b/commhandler/requirements-doc.txt index b925000..81cd4c3 100644 --- a/commhandler/requirements-doc.txt +++ b/commhandler/requirements-doc.txt @@ -1,3 +1,3 @@ -sphinx>=7.4.0,<8.0.0 -sphinx-autoapi>=3.6.0,<4.0.0 -sphinx-rtd-theme>=3.0.0,<4.0.0 +sphinx>=7.4.7,<8.0.0 +sphinx-autoapi>=3.6.1,<4.0.0 +sphinx-rtd-theme>=3.0.2,<4.0.0 diff --git a/commhandler/requirements.txt b/commhandler/requirements.txt index 464077d..9d84aa5 100644 --- a/commhandler/requirements.txt +++ b/commhandler/requirements.txt @@ -1,12 +1,12 @@ -Jinja2>=3.1.0,<4.0.0 -jmespath>=1.0.0,<2.0.0 +Jinja2>=3.1.6,<4.0.0 +jmespath>=1.0.1,<2.0.0 jsonata-python>=0.6.0,<1.0.0 parsel>=1.10.0,<1.11.0 -pymodbus[serial]>=3.7.0,<3.8.0 +pymodbus[serial]>=3.7.4,<3.8.0 gmqtt>=0.7.0,<1.0.0 -xsdata>=25.0.0,<26.0.0 -xmlschema>=4.1.0,<5.0.0 -aiohttp>=3.12.0,<4.0.0 -certifi -cachetools>=6.2.0,<7.0.0 +xsdata>=25.7.0,<26.0.0 +xmlschema>=4.2.0,<5.0.0 +aiohttp>=3.13.2,<4.0.0 +certifi>=25.11.12 +cachetools>=6.2.4,<7.0.0 sgr-specification>=2.2.0,<3.0.0 From e75c62710687833db17314220226525d3ff3c044 Mon Sep 17 00:00:00 2001 From: Matthias Krebs Date: Wed, 17 Dec 2025 18:41:39 +0100 Subject: [PATCH 4/5] bump version. --- commhandler/CHANGELOG.md | 2 +- specification/requirements-dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/commhandler/CHANGELOG.md b/commhandler/CHANGELOG.md index c27d6fc..d5c2feb 100644 --- a/commhandler/CHANGELOG.md +++ b/commhandler/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [unreleased] +## [0.5.1] - 2025-12-17 ## Changed diff --git a/specification/requirements-dev.txt b/specification/requirements-dev.txt index 2e3e6c0..e5c5bdd 100644 --- a/specification/requirements-dev.txt +++ b/specification/requirements-dev.txt @@ -1 +1 @@ -xsdata[cli]>=25.0.0,<26.0.0 +xsdata[cli]>=25.7.0,<26.0.0 From 53baef3e070304580ebc05c5564c071243ff311c Mon Sep 17 00:00:00 2001 From: Matthias Krebs Date: Thu, 18 Dec 2025 10:34:41 +0100 Subject: [PATCH 5/5] fixed Modbus timeout values. --- .../sgr_commhandler/driver/modbus/modbus_client_async.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py b/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py index 29d4ac7..5cb6412 100644 --- a/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py +++ b/commhandler/src/sgr_commhandler/driver/modbus/modbus_client_async.py @@ -262,10 +262,10 @@ def __init__(self, ip: str, port: int, endianness: BitOrder = BitOrder.BIG_ENDIA AsyncModbusTcpClient( host=ip, port=port, - timeout=1, + timeout=1.0, retries=0, - reconnect_delay=5000, - reconnect_delay_max=30000 + reconnect_delay=1.0, + reconnect_delay_max=30.0 ) ) """