From cd0191b2fac0ec26199cec45efab4657790083ff Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 28 Apr 2026 14:02:35 +0200 Subject: [PATCH 1/9] Migrate to serialx --- plugwise_usb/connection/manager.py | 7 +------ plugwise_usb/connection/receiver.py | 2 +- pyproject.toml | 2 +- requirements_test.txt | 2 +- tests/test_usb.py | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/plugwise_usb/connection/manager.py b/plugwise_usb/connection/manager.py index 7dea480be..2d46b3d66 100644 --- a/plugwise_usb/connection/manager.py +++ b/plugwise_usb/connection/manager.py @@ -7,8 +7,7 @@ import logging from typing import Any -from serial import EIGHTBITS, PARITY_NONE, STOPBITS_ONE, SerialException -from serial_asyncio_fast import SerialTransport, create_serial_connection +from serialx import SerialException, SerialTransport, create_serial_connection from ..api import StickEvent from ..exceptions import StickError @@ -132,10 +131,6 @@ async def setup_connection_to_stick(self, serial_path: str) -> None: lambda: self._receiver, url=serial_path, baudrate=115200, - bytesize=EIGHTBITS, - stopbits=STOPBITS_ONE, - parity=PARITY_NONE, - xonxoff=False, ), timeout=5, ) diff --git a/plugwise_usb/connection/receiver.py b/plugwise_usb/connection/receiver.py index 4651dab6f..1dee3f8a4 100644 --- a/plugwise_usb/connection/receiver.py +++ b/plugwise_usb/connection/receiver.py @@ -33,7 +33,7 @@ import logging from typing import Any, Final -from serial_asyncio_fast import SerialTransport +from serialx import SerialTransport from ..api import StickEvent from ..constants import MESSAGE_FOOTER, MESSAGE_HEADER diff --git a/pyproject.toml b/pyproject.toml index 8d6a058d9..f5273d332 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,10 +27,10 @@ maintainers = [ ] requires-python = ">=3.13.0" dependencies = [ - "pyserial-asyncio-fast", "aiofiles", "crcmod", "semver", + "serialx", ] [project.urls] diff --git a/requirements_test.txt b/requirements_test.txt index 8ba5106ed..6aa256bc4 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -4,7 +4,7 @@ pytest-asyncio radon==6.0.1 types-python-dateutil -pyserial-asyncio-fast aiofiles freezegun pytest-cov +serialx diff --git a/tests/test_usb.py b/tests/test_usb.py index 59e62cd44..df739ca5b 100644 --- a/tests/test_usb.py +++ b/tests/test_usb.py @@ -366,7 +366,7 @@ async def test_stick_connect_without_port(self) -> None: with pytest.raises(pw_exceptions.StickError): await stick.connect() - stick.port = "null" + stick.port = None with pytest.raises(pw_exceptions.StickError): await stick.connect() await stick.disconnect() From 7356241bf44e743e9a2ba777de57c3d356b833d2 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 28 Apr 2026 19:14:14 +0200 Subject: [PATCH 2/9] Bump to v0.47.7a0 - test-version --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d9bb8190..665774a5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Ongoing + +PR []() + ## v0.47.6 - 2026-03-11 PR [425](https://github.com/plugwise/python-plugwise-usb/pull/425): More 0138-related improvements diff --git a/pyproject.toml b/pyproject.toml index f5273d332..9ebed4dce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise_usb" -version = "0.47.6" +version = "0.47.7a0" license = "MIT" keywords = ["home", "automation", "plugwise", "module", "usb"] classifiers = [ From b386215cfba3671740c292248206810341b0f631 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 28 Apr 2026 19:15:34 +0200 Subject: [PATCH 3/9] Update CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 665774a5d..b78575216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Ongoing -PR []() +PR [433](https://github.com/plugwise/python-plugwise-usb/pull/443): Migrate to serialx ## v0.47.6 - 2026-03-11 From 6a5345496597f1e1909936444b6e912a17382d7d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 28 Apr 2026 19:22:41 +0200 Subject: [PATCH 4/9] Improve exception-handling as suggested --- plugwise_usb/connection/manager.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/plugwise_usb/connection/manager.py b/plugwise_usb/connection/manager.py index 2d46b3d66..8eb70aa8a 100644 --- a/plugwise_usb/connection/manager.py +++ b/plugwise_usb/connection/manager.py @@ -134,11 +134,7 @@ async def setup_connection_to_stick(self, serial_path: str) -> None: ), timeout=5, ) - except SerialException as err: - raise StickError( - f"Failed to open serial connection to {serial_path}" - ) from err - except TimeoutError as err: + except (SerialException, TimeoutError, TypeError, ValueError) as err: raise StickError( f"Failed to open serial connection to {serial_path}" ) from err From 0758d68b4af4067bec43dda54917dd54f9e14b57 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 29 Apr 2026 19:23:13 +0200 Subject: [PATCH 5/9] Revert test-change, catch new error --- plugwise_usb/connection/manager.py | 8 +++++++- tests/test_usb.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugwise_usb/connection/manager.py b/plugwise_usb/connection/manager.py index 8eb70aa8a..f9478a9eb 100644 --- a/plugwise_usb/connection/manager.py +++ b/plugwise_usb/connection/manager.py @@ -134,7 +134,13 @@ async def setup_connection_to_stick(self, serial_path: str) -> None: ), timeout=5, ) - except (SerialException, TimeoutError, TypeError, ValueError) as err: + except ( + FileNotFoundError, + OSError, + TimeoutError, + TypeError, + ValueError, + ) as err: raise StickError( f"Failed to open serial connection to {serial_path}" ) from err diff --git a/tests/test_usb.py b/tests/test_usb.py index df739ca5b..59e62cd44 100644 --- a/tests/test_usb.py +++ b/tests/test_usb.py @@ -366,7 +366,7 @@ async def test_stick_connect_without_port(self) -> None: with pytest.raises(pw_exceptions.StickError): await stick.connect() - stick.port = None + stick.port = "null" with pytest.raises(pw_exceptions.StickError): await stick.connect() await stick.disconnect() From b56b927dea3526aef476fc797e4432c982dc6d38 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 29 Apr 2026 19:57:56 +0200 Subject: [PATCH 6/9] Remove 3.13 reference --- pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9ebed4dce..dc1d282a8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,6 @@ classifiers = [ "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python :: 3.14", - "Programming Language :: Python :: 3.13", "Topic :: Home Automation", ] authors = [ @@ -25,7 +24,7 @@ maintainers = [ { name = "CoMPaTech" }, { name = "dirixmjm" } ] -requires-python = ">=3.13.0" +requires-python = ">=3.14.0" dependencies = [ "aiofiles", "crcmod", From 5a8049159546b5fd2420959618ff385ed03fbf44 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 29 Apr 2026 19:59:51 +0200 Subject: [PATCH 7/9] Bump CACHE_VERSIONs --- .github/workflows/merge.yml | 2 +- .github/workflows/verify.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index f82cfebd6..7a312203d 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -4,7 +4,7 @@ name: Latest release env: - CACHE_VERSION: 1 + CACHE_VERSION: 2 DEFAULT_PYTHON: "3.14" # Only run on merges diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index b3b4f6a98..1a81ae365 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -4,7 +4,7 @@ name: Latest commit env: - CACHE_VERSION: 2 + CACHE_VERSION: 3 DEFAULT_PYTHON: "3.14" VENV: venv From 8068385a0bed42a28d2ba724f5d21c4a53b8e6c7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 29 Apr 2026 20:02:14 +0200 Subject: [PATCH 8/9] Clean up redundant exceptions --- plugwise_usb/connection/manager.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/plugwise_usb/connection/manager.py b/plugwise_usb/connection/manager.py index f9478a9eb..d70734f4a 100644 --- a/plugwise_usb/connection/manager.py +++ b/plugwise_usb/connection/manager.py @@ -134,13 +134,7 @@ async def setup_connection_to_stick(self, serial_path: str) -> None: ), timeout=5, ) - except ( - FileNotFoundError, - OSError, - TimeoutError, - TypeError, - ValueError, - ) as err: + except (OSError, TypeError, ValueError) as err: raise StickError( f"Failed to open serial connection to {serial_path}" ) from err From e646b2e9969bcccf6cf5e2723267be2a0d277ca7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 29 Apr 2026 20:09:20 +0200 Subject: [PATCH 9/9] Remove ununsed import --- plugwise_usb/connection/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise_usb/connection/manager.py b/plugwise_usb/connection/manager.py index d70734f4a..4d6a13bb9 100644 --- a/plugwise_usb/connection/manager.py +++ b/plugwise_usb/connection/manager.py @@ -7,7 +7,7 @@ import logging from typing import Any -from serialx import SerialException, SerialTransport, create_serial_connection +from serialx import SerialTransport, create_serial_connection from ..api import StickEvent from ..exceptions import StickError