aioccl 2025.6__tar.gz → 2025.6.2__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
3
+ Version: 2025.6.2
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."""
@@ -277,25 +277,25 @@ CCL_SENSORS: dict[str, CCLSensorPreset] = {
277
277
  "CH7 Type", CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.OTHER
278
278
  ),
279
279
  "t6c1wls": CCLSensorPreset(
280
- "Leakage CH1", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
280
+ "Leakage CH1", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
281
281
  ),
282
282
  "t6c2wls": CCLSensorPreset(
283
- "Leakage CH2", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
283
+ "Leakage CH2", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
284
284
  ),
285
285
  "t6c3wls": CCLSensorPreset(
286
- "Leakage CH3", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
286
+ "Leakage CH3", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
287
287
  ),
288
288
  "t6c4wls": CCLSensorPreset(
289
- "Leakage CH4", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
289
+ "Leakage CH4", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
290
290
  ),
291
291
  "t6c5wls": CCLSensorPreset(
292
- "Leakage CH5", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
292
+ "Leakage CH5", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
293
293
  ),
294
294
  "t6c6wls": CCLSensorPreset(
295
- "Leakage CH6", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
295
+ "Leakage CH6", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
296
296
  ),
297
297
  "t6c7wls": CCLSensorPreset(
298
- "Leakage CH7", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER, True
298
+ "Leakage CH7", CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.OTHER
299
299
  ),
300
300
  "t5lskm": CCLSensorPreset(
301
301
  "Lightning Distance",
@@ -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[device.passkey] 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
3
+ Version: 2025.6.2
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"
6
+ VERSION = "2025.6.2"
7
7
 
8
8
  ROOT_DIR = Path(__file__).parent.resolve()
9
9
 
File without changes
File without changes
File without changes
File without changes