aioccl 2025.6.1__tar.gz → 2025.6.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioccl
3
- Version: 2025.6.1
3
+ Version: 2025.6.3
4
4
  Summary: A Python library for CCL API server
5
5
  Home-page: https://github.com/CCL-Electronics-Ltd/aioccl
6
6
  Download-URL: https://github.com/CCL-Electronics-Ltd/aioccl
@@ -6,6 +6,7 @@ import logging
6
6
  import time
7
7
  from typing import Callable, TypedDict
8
8
 
9
+ from .exception import CCLDataUpdateException
9
10
  from .sensor import CCLSensor, CCL_SENSORS
10
11
 
11
12
  _LOGGER = logging.getLogger(__name__)
@@ -83,10 +84,12 @@ class CCLDevice:
83
84
  def fw_ver(self) -> str | None:
84
85
  """Return the firmware version."""
85
86
  return self._info["fw_ver"]
86
-
87
+
87
88
  @property
88
89
  def get_sensors(self) -> dict[str, CCLSensor]:
89
90
  """Get all types of sensor data under this device."""
91
+ if len(self._sensors) == 0:
92
+ raise CCLDataUpdateException("Device is offline or not ready")
90
93
  return self._sensors
91
94
 
92
95
  def update_info(self, new_info: dict[str, None | str]) -> None:
@@ -0,0 +1,7 @@
1
+ """Exceptions for aioccl."""
2
+
3
+ class CCLDeviceRegistrationException(Exception):
4
+ """Exception when registering a new device."""
5
+
6
+ class CCLDataUpdateException(Exception):
7
+ """Exception when updating data."""
@@ -8,6 +8,7 @@ import logging
8
8
  from aiohttp import web
9
9
 
10
10
  from .device import CCLDevice, CCL_DEVICE_INFO_TYPES
11
+ from .exception import CCLDeviceRegistrationException
11
12
  from .sensor import CCL_SENSORS
12
13
 
13
14
  _LOGGER = logging.getLogger(__name__)
@@ -23,6 +24,8 @@ class CCLServer:
23
24
  @staticmethod
24
25
  def register(device: CCLDevice) -> None:
25
26
  """Register a device with a passkey."""
27
+ if CCLServer.devices.get(device.passkey, None) is not None:
28
+ raise CCLDeviceRegistrationException("Device already exists")
26
29
  CCLServer.devices[device.passkey] = device
27
30
  _LOGGER.debug("Device registered: %s", device.passkey)
28
31
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioccl
3
- Version: 2025.6.1
3
+ Version: 2025.6.3
4
4
  Summary: A Python library for CCL API server
5
5
  Home-page: https://github.com/CCL-Electronics-Ltd/aioccl
6
6
  Download-URL: https://github.com/CCL-Electronics-Ltd/aioccl
@@ -4,6 +4,7 @@ setup.cfg
4
4
  setup.py
5
5
  aioccl/__init__.py
6
6
  aioccl/device.py
7
+ aioccl/exception.py
7
8
  aioccl/sensor.py
8
9
  aioccl/server.py
9
10
  aioccl.egg-info/PKG-INFO
@@ -3,7 +3,7 @@
3
3
  from pathlib import Path
4
4
  from setuptools import find_packages, setup
5
5
 
6
- VERSION = "2025.6.1"
6
+ VERSION = "2025.6.3"
7
7
 
8
8
  ROOT_DIR = Path(__file__).parent.resolve()
9
9
 
File without changes
File without changes
File without changes
File without changes
File without changes