From f2a278ec74190b4c1100b55ac6f710538faf56f6 Mon Sep 17 00:00:00 2001 From: spacemanspiff2007 <10754716+spacemanspiff2007@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:52:05 +0200 Subject: [PATCH] 3.1 --- docs/requirements.txt | 6 +++--- readme.md | 4 ++++ requirements.txt | 2 +- requirements_setup.txt | 2 +- src/sml2mqtt/__main__.py | 7 ++++++- src/sml2mqtt/__version__.py | 2 +- src/sml2mqtt/sml_device/sml_devices.py | 3 +++ 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/docs/requirements.txt b/docs/requirements.txt index 02e630c..680748c 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,6 +1,6 @@ # Packages required to build the documentation -sphinx == 7.2.6 -sphinx-autodoc-typehints == 2.0.0 +sphinx == 7.4.7 +sphinx-autodoc-typehints == 2.2.3 sphinx_rtd_theme == 2.0.0 sphinx-exec-code == 0.12 -autodoc_pydantic == 2.1.0 +autodoc_pydantic == 2.2.0 diff --git a/readme.md b/readme.md index a778969..856351e 100644 --- a/readme.md +++ b/readme.md @@ -21,6 +21,10 @@ To read from the serial port an IR to USB reader for energy meter is required. # Changelog +#### 3.1 (2024-08-05) +- Updated dependencies +- Added some small log messages + #### 3.0 (2024-04-24) **BREAKING CHANGE** diff --git a/requirements.txt b/requirements.txt index 5f7eb87..245c0e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ pytest-asyncio == 0.23.8 aioresponses == 0.7.6 # Linter -ruff == 0.5.5 +ruff == 0.5.6 diff --git a/requirements_setup.txt b/requirements_setup.txt index b7ee725..46b9c82 100644 --- a/requirements_setup.txt +++ b/requirements_setup.txt @@ -3,4 +3,4 @@ pyserial-asyncio == 0.6 easyconfig == 0.3.2 pydantic == 2.8.2 smllib == 1.4 -aiohttp == 3.10.0 +aiohttp == 3.10.1 diff --git a/src/sml2mqtt/__main__.py b/src/sml2mqtt/__main__.py index 47e1f64..a21c0c0 100644 --- a/src/sml2mqtt/__main__.py +++ b/src/sml2mqtt/__main__.py @@ -36,9 +36,14 @@ async def a_main(): device.frame_handler = device.analyze_frame # Start all devices + log.debug(f'Starting {len(ALL_DEVICES):d} device{"" if len(ALL_DEVICES) == 1 else "s":s}') await ALL_DEVICES.start() - except Exception: + except Exception as e: + log.error(f'{e.__class__.__name__} during startup: {e}') + for line in traceback.format_exc().splitlines(): + log.error(line) + await do_shutdown_async() # Keep tasks running diff --git a/src/sml2mqtt/__version__.py b/src/sml2mqtt/__version__.py index f7d2e86..27d4bb6 100644 --- a/src/sml2mqtt/__version__.py +++ b/src/sml2mqtt/__version__.py @@ -1 +1 @@ -__version__ = '3.0' +__version__ = '3.1' diff --git a/src/sml2mqtt/sml_device/sml_devices.py b/src/sml2mqtt/sml_device/sml_devices.py index 7b864b2..4ea1a1d 100644 --- a/src/sml2mqtt/sml_device/sml_devices.py +++ b/src/sml2mqtt/sml_device/sml_devices.py @@ -40,5 +40,8 @@ def check_status(self): return None + def __len__(self) -> int: + return len(self._devices) + ALL_DEVICES: Final = SmlDevices()