From 0ced2e6c5c7dd6b1a9d9302a290844ebf5457210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jaworski?= Date: Mon, 3 Jun 2024 21:27:09 +0200 Subject: [PATCH 1/3] remove obsolete errors --- blebox_uniapi/error.py | 27 +--------------------- blebox_uniapi/session.py | 4 ++-- tests/test_error.py | 48 ---------------------------------------- 3 files changed, 3 insertions(+), 76 deletions(-) delete mode 100644 tests/test_error.py diff --git a/blebox_uniapi/error.py b/blebox_uniapi/error.py index 5dbca4e..08f3aa2 100644 --- a/blebox_uniapi/error.py +++ b/blebox_uniapi/error.py @@ -5,13 +5,7 @@ class Error(RuntimeError): # Likely fixable/retriable network/busy errors - - -class TemporaryError(Error): - pass - - -class ConnectionError(TemporaryError): +class ConnectionError(Error): pass @@ -20,8 +14,6 @@ class TimeoutError(ConnectionError): # Likely unfixable device errors (do not setup) - - class ClientError(Error): pass @@ -35,8 +27,6 @@ class UnauthorizedRequest(ClientError): # API errors - - class BoxError(Error): pass @@ -49,15 +39,6 @@ class UnsupportedBoxVersion(BoxError): pass -class UnsupportedAppVersion(BoxError): - pass - - -# TODO: not used yet -# class OutdatedBoxVersion(BoxError): -# pass - - class BadFieldExceedsMax(BoxError): def __init__(self, dev_name: str, field: str, value: int, max_value: int): @@ -122,12 +103,6 @@ def __str__(self) -> str: return f"{self._dev_name}.{self._field} is {self._value} which is not a rgbw string" -# API command errors - - -class BadOnValueError(BoxError): - pass - # misc errors diff --git a/blebox_uniapi/session.py b/blebox_uniapi/session.py index bc7dc5b..d7b80c2 100644 --- a/blebox_uniapi/session.py +++ b/blebox_uniapi/session.py @@ -71,12 +71,12 @@ async def async_request( except asyncio.TimeoutError as ex: raise error.TimeoutError( f"Failed to connect to {self.host}:{self.port} within {client_timeout}s: ({ex})" - ) from None + ) from ex except aiohttp.ClientConnectionError as ex: raise error.ConnectionError( f"Failed to connect to {self.host}:{self.port}: {ex}" - ) from None + ) from ex except aiohttp.ClientError as ex: raise error.ClientError(f"API request {url} failed: {ex}") from ex diff --git a/tests/test_error.py b/tests/test_error.py deleted file mode 100644 index 5de0e97..0000000 --- a/tests/test_error.py +++ /dev/null @@ -1,48 +0,0 @@ -from blebox_uniapi.error import ( - Error, - TemporaryError, - ConnectionError, - TimeoutError, - ClientError, - HttpError, - BoxError, -) - -ALL = set([Error, ConnectionError, TimeoutError, ClientError, HttpError, BoxError]) - - -def assert_is_a(subject, errors): - for error in errors: - assert issubclass(subject, error) - - remaining = ALL - set(errors) - set([subject]) - for error in remaining: - assert not issubclass(subject, error) - - -def test_error(): - assert_is_a(Error, (Error,)) - - -def test_temporary_error(): - assert_is_a(TemporaryError, (Error,)) - - -def test_connection_error(): - assert_is_a(ConnectionError, (Error, TemporaryError)) - - -def test_timeout_error(): - assert_is_a(TimeoutError, (Error, ConnectionError, TemporaryError)) - - -def test_client_error(): - assert_is_a(ClientError, (Error,)) - - -def test_http_error(): - assert_is_a(HttpError, (Error, ClientError)) - - -def test_box_error(): - assert_is_a(BoxError, (Error,)) From 2b7ca95bdbede152b3551e09d90d4623521dddd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jaworski?= Date: Mon, 3 Jun 2024 23:00:47 +0200 Subject: [PATCH 2/3] dist: prep 2.4.0 release --- blebox_uniapi/__init__.py | 2 +- setup.cfg | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/blebox_uniapi/__init__.py b/blebox_uniapi/__init__.py index f610e42..02d7376 100644 --- a/blebox_uniapi/__init__.py +++ b/blebox_uniapi/__init__.py @@ -2,4 +2,4 @@ __author__ = """BleBox""" __email__ = "opensource@blebox.eu" -__version__ = "2.3.0" +__version__ = "2.4.0" diff --git a/setup.cfg b/setup.cfg index 45b6332..7d7f978 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 2.3.0 +current_version = 2.4.0 commit = True tag = True diff --git a/setup.py b/setup.py index 88a780c..5c3a7bc 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ ] setup( - version="2.3.0", + version="2.4.0", author="BleBox", author_email="opensource@blebox.eu", python_requires=">=3.9", From 8494f554ce1e7a8943c1c44d56384a8d4238e5b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jaworski?= Date: Mon, 3 Jun 2024 23:06:28 +0200 Subject: [PATCH 3/3] dist: update changelog and contributors --- CREDITS.md | 1 + HISTORY.rst | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CREDITS.md b/CREDITS.md index 13e7a18..2ea3c46 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -12,6 +12,7 @@ Project contributors (in alphabetical order) - @riokuu - @swistakm - @Pastucha +- @pvsti ## Projects - Initial scaffolding for this project was created using [cookiecutter](https://github.com/audreyr/cookiecutter) and diff --git a/HISTORY.rst b/HISTORY.rst index 5b1efe8..b8e70b2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,14 @@ ======= History ======= +2.4.0 (2024-06-03) +------------------ +* Fix: Refactor sensor_factory by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/163 +* Order in BOX_TYPES by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/164 +* Feature: smart meter by @swistakm in https://github.com/blebox/blebox_uniapi/pull/168 +* Smartmeter by @pvsti in https://github.com/blebox/blebox_uniapi/pull/170 +* fix: resolve regressions in cover and climate due to jmespath introduction by @swistakm in https://github.com/blebox/blebox_uniapi/pull/173 + 2.3.0 (2024-03-13) ------------------ * feat: add new methods to cover feature enabling handling of tilt open/close actions by @swistakm in https://github.com/blebox/blebox_uniapi/pull/154