aioccl 2025.6.4__tar.gz → 2025.6.5__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.
- {aioccl-2025.6.4 → aioccl-2025.6.5}/PKG-INFO +1 -1
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl/device.py +15 -20
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl.egg-info/PKG-INFO +1 -1
- {aioccl-2025.6.4 → aioccl-2025.6.5}/setup.py +1 -1
- {aioccl-2025.6.4 → aioccl-2025.6.5}/LICENSE +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/README.md +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl/__init__.py +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl/exception.py +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl/sensor.py +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl/server.py +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl.egg-info/SOURCES.txt +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl.egg-info/dependency_links.txt +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl.egg-info/requires.txt +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/aioccl.egg-info/top_level.txt +0 -0
- {aioccl-2025.6.4 → aioccl-2025.6.5}/setup.cfg +0 -0
@@ -40,11 +40,10 @@ class CCLDevice:
|
|
40
40
|
}
|
41
41
|
|
42
42
|
self._sensors: dict[str, CCLSensor] = {}
|
43
|
-
|
44
|
-
self._update_callback = {}
|
43
|
+
self._update_callback: Callable[[], None] | None = None
|
45
44
|
|
46
45
|
self._new_sensors: list[CCLSensor] | None = []
|
47
|
-
self.
|
46
|
+
self._new_sensor_callback: Callable[[], None] | None = None
|
48
47
|
|
49
48
|
@property
|
50
49
|
def passkey(self) -> str:
|
@@ -108,12 +107,13 @@ class CCLDevice:
|
|
108
107
|
self._sensors[key].value = value
|
109
108
|
|
110
109
|
add_count = self._publish_new_sensors()
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
110
|
+
if add_count > 0:
|
111
|
+
_LOGGER.debug(
|
112
|
+
"Added %s new sensors for device %s at %s.",
|
113
|
+
add_count,
|
114
|
+
self.device_id,
|
115
|
+
self.last_update_time,
|
116
|
+
)
|
117
117
|
|
118
118
|
self._publish_updates()
|
119
119
|
_LOGGER.debug(
|
@@ -137,13 +137,9 @@ class CCLDevice:
|
|
137
137
|
err,
|
138
138
|
)
|
139
139
|
|
140
|
-
def
|
141
|
-
"""
|
142
|
-
self.
|
143
|
-
|
144
|
-
def remove_new_sensor_cb(self, callback: Callable[[], None]) -> None:
|
145
|
-
"""Remove a registered callback."""
|
146
|
-
self._new_sensor_callbacks.discard(callback)
|
140
|
+
def set_new_sensor_callback(self, callback: Callable[[], None]) -> None:
|
141
|
+
"""Set the callback function to add a new sensor."""
|
142
|
+
self._new_sensor_callback = callback
|
147
143
|
|
148
144
|
def _publish_new_sensors(self) -> int:
|
149
145
|
"""Schedule all registered callbacks to add new sensors."""
|
@@ -151,10 +147,9 @@ class CCLDevice:
|
|
151
147
|
error_count = 0
|
152
148
|
for sensor in self._new_sensors[:]:
|
153
149
|
try:
|
154
|
-
assert
|
155
|
-
|
156
|
-
|
157
|
-
raise CCLDataUpdateException("Failed to publish new sensor")
|
150
|
+
assert self._new_sensor_callback is not None
|
151
|
+
if self._new_sensor_callback(sensor) is not True:
|
152
|
+
raise CCLDataUpdateException("Failed to publish new sensor")
|
158
153
|
self._new_sensors.remove(sensor)
|
159
154
|
success_count += 1
|
160
155
|
except Exception: # pylint: disable=broad-exception-caught
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|