aioccl 2025.6.7__py3-none-any.whl → 2025.7__py3-none-any.whl

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.
aioccl/device.py CHANGED
@@ -7,7 +7,7 @@ import time
7
7
  from typing import Callable, TypedDict
8
8
 
9
9
  from .exception import CCLDataUpdateException
10
- from .sensor import CCLSensor, CCL_SENSORS
10
+ from .sensor import CCLSensor
11
11
 
12
12
  _LOGGER = logging.getLogger(__name__)
13
13
 
@@ -83,13 +83,23 @@ class CCLDevice:
83
83
  def fw_ver(self) -> str | None:
84
84
  """Return the firmware version."""
85
85
  return self._info["fw_ver"]
86
-
87
- @property
86
+
88
87
  def get_sensors(self) -> dict[str, CCLSensor]:
89
88
  """Get all types of sensor data under this device."""
90
- if len(self._sensors) == 0:
89
+ if self._info["last_update_time"] is None:
90
+ raise CCLDataUpdateException("Device is offline or not ready")
91
+ if len(self._sensors) == 0 or time.monotonic() - self._info["last_update_time"] > 600:
91
92
  raise CCLDataUpdateException("Device is offline or not ready")
92
93
  return self._sensors
94
+
95
+ def set_update_callback(self, callback: Callable[[], None]) -> None:
96
+ """Set the callback function to update sensor data."""
97
+ self._update_callback = callback
98
+
99
+ def set_new_sensor_callback(self, callback: Callable[[], None]) -> None:
100
+ """Set the callback function to add a new sensor."""
101
+ self._new_sensor_callback = callback
102
+
93
103
 
94
104
  def update_info(self, new_info: dict[str, None | str]) -> None:
95
105
  """Add or update device info."""
@@ -126,10 +136,6 @@ class CCLDevice:
126
136
  self._sensors[key].value = value
127
137
  self.push_updates()
128
138
 
129
- def set_update_callback(self, callback: Callable[[], None]) -> None:
130
- """Set the callback function to update sensor data."""
131
- self._update_callback = callback
132
-
133
139
  def _publish_updates(self) -> None:
134
140
  """Call the function to update sensor data."""
135
141
  try:
@@ -141,10 +147,6 @@ class CCLDevice:
141
147
  err,
142
148
  )
143
149
 
144
- def set_new_sensor_callback(self, callback: Callable[[], None]) -> None:
145
- """Set the callback function to add a new sensor."""
146
- self._new_sensor_callback = callback
147
-
148
150
  def _publish_new_sensors(self) -> int:
149
151
  """Schedule all registered callbacks to add new sensors."""
150
152
  success_count = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioccl
3
- Version: 2025.6.7
3
+ Version: 2025.7
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
@@ -0,0 +1,10 @@
1
+ aioccl/__init__.py,sha256=XnegKtbvHvUTwVuuWNLb4LB9ZuGGar0xrZYOqk7scyg,133
2
+ aioccl/device.py,sha256=xb6UGGhlpFJ_2CAFv19oYqajtTTt3i-pEJSn3vmoWAE,5628
3
+ aioccl/exception.py,sha256=iTukjNcnVXVhGV_sMGj2D1jzjVXB0qcyOlX2vB8G4AY,211
4
+ aioccl/sensor.py,sha256=2HFUGEYPvbWpkHsZwrrCvtCZGrI5ZGEuGuBCPE9W-NQ,16650
5
+ aioccl/server.py,sha256=W8OL64dAi2WAeS4isx8usAG-9D3q4mBIl9pxxb4Iuhw,3573
6
+ aioccl-2025.7.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
7
+ aioccl-2025.7.dist-info/METADATA,sha256=fQo0mIj1o5xp8dByu-Y1PPwbweJBGi4dE5Wu_-UG6x4,989
8
+ aioccl-2025.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ aioccl-2025.7.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
10
+ aioccl-2025.7.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- aioccl/__init__.py,sha256=XnegKtbvHvUTwVuuWNLb4LB9ZuGGar0xrZYOqk7scyg,133
2
- aioccl/device.py,sha256=q-u2IW_3waqZeQH7qSUG68R6QIEMpVjjODYyWG4ehA8,5461
3
- aioccl/exception.py,sha256=iTukjNcnVXVhGV_sMGj2D1jzjVXB0qcyOlX2vB8G4AY,211
4
- aioccl/sensor.py,sha256=2HFUGEYPvbWpkHsZwrrCvtCZGrI5ZGEuGuBCPE9W-NQ,16650
5
- aioccl/server.py,sha256=W8OL64dAi2WAeS4isx8usAG-9D3q4mBIl9pxxb4Iuhw,3573
6
- aioccl-2025.6.7.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
7
- aioccl-2025.6.7.dist-info/METADATA,sha256=aH6ek-9-zZrcr4MVAj8O9fv-QQRXMgMOLas42eaRgQ8,991
8
- aioccl-2025.6.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- aioccl-2025.6.7.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
10
- aioccl-2025.6.7.dist-info/RECORD,,