aioccl 2025.6.6__py3-none-any.whl → 2025.6.8__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
@@ -87,7 +87,9 @@ class CCLDevice:
87
87
  @property
88
88
  def get_sensors(self) -> dict[str, CCLSensor]:
89
89
  """Get all types of sensor data under this device."""
90
- if len(self._sensors) == 0:
90
+ if self._info["last_update_time"] is None:
91
+ raise CCLDataUpdateException("Device is offline or not ready")
92
+ if len(self._sensors) == 0 or time.monotonic() - self._info["last_update_time"] > 600:
91
93
  raise CCLDataUpdateException("Device is offline or not ready")
92
94
  return self._sensors
93
95
 
@@ -98,15 +100,8 @@ class CCLDevice:
98
100
  self._info[key] = str(value)
99
101
  self._info["last_update_time"] = time.monotonic()
100
102
 
101
- def process_data(self, data: dict[str, None | str | int | float]) -> None:
102
- """Add or update all sensor values."""
103
- for key, value in data.items():
104
- if key not in self._sensors:
105
- self._sensors[key] = CCLSensor(key)
106
- self._new_sensors.append(self._sensors[key])
107
- self._sensors[key].last_update_time = time.monotonic()
108
- self._sensors[key].value = value
109
-
103
+ def push_updates(self) -> None:
104
+ """Push sensor updates."""
110
105
  add_count = self._publish_new_sensors()
111
106
  if add_count > 0:
112
107
  _LOGGER.debug(
@@ -122,6 +117,16 @@ class CCLDevice:
122
117
  self.device_id,
123
118
  self.last_update_time,
124
119
  )
120
+
121
+ def process_data(self, data: dict[str, None | str | int | float]) -> None:
122
+ """Add or update all sensor values."""
123
+ for key, value in data.items():
124
+ if key not in self._sensors:
125
+ self._sensors[key] = CCLSensor(key)
126
+ self._new_sensors.append(self._sensors[key])
127
+ self._sensors[key].last_update_time = time.monotonic()
128
+ self._sensors[key].value = value
129
+ self.push_updates()
125
130
 
126
131
  def set_update_callback(self, callback: Callable[[], None]) -> None:
127
132
  """Set the callback function to update sensor data."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aioccl
3
- Version: 2025.6.6
3
+ Version: 2025.6.8
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=I38yGJVSaChQUgi2InPRweX3s4FXchJQLs4IHv4IdAo,5646
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.8.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
7
+ aioccl-2025.6.8.dist-info/METADATA,sha256=IJ9BVcileQWwL2OufRHEgHPf-geY5yQO1ggd9eN2gfc,991
8
+ aioccl-2025.6.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ aioccl-2025.6.8.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
10
+ aioccl-2025.6.8.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- aioccl/__init__.py,sha256=XnegKtbvHvUTwVuuWNLb4LB9ZuGGar0xrZYOqk7scyg,133
2
- aioccl/device.py,sha256=tu9gqtYVd6jVCW2r6kZPEpSd0Rvs9OpnvkMmAD_4p9Y,5354
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.6.dist-info/licenses/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
7
- aioccl-2025.6.6.dist-info/METADATA,sha256=NYp2MMj2-w6Zx_ajiKQwi7PtUlaHZNxceySEQGkEfYw,991
8
- aioccl-2025.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
- aioccl-2025.6.6.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
10
- aioccl-2025.6.6.dist-info/RECORD,,