aioccl 2025.6.3__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.3 → aioccl-2025.6.5}/PKG-INFO +1 -1
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl/device.py +26 -27
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl.egg-info/PKG-INFO +1 -1
- {aioccl-2025.6.3 → aioccl-2025.6.5}/setup.py +1 -1
- {aioccl-2025.6.3 → aioccl-2025.6.5}/LICENSE +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/README.md +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl/__init__.py +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl/exception.py +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl/sensor.py +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl/server.py +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl.egg-info/SOURCES.txt +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl.egg-info/dependency_links.txt +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl.egg-info/requires.txt +0 -0
- {aioccl-2025.6.3 → aioccl-2025.6.5}/aioccl.egg-info/top_level.txt +0 -0
- {aioccl-2025.6.3 → 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,28 +137,27 @@ class CCLDevice:
|
|
137
137
|
err,
|
138
138
|
)
|
139
139
|
|
140
|
-
def
|
141
|
-
"""
|
142
|
-
self.
|
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
|
143
143
|
|
144
|
-
def
|
145
|
-
"""Remove a registered callback."""
|
146
|
-
self._new_sensor_callbacks.discard(callback)
|
147
|
-
|
148
|
-
def _publish_new_sensors(self) -> None:
|
144
|
+
def _publish_new_sensors(self) -> int:
|
149
145
|
"""Schedule all registered callbacks to add new sensors."""
|
150
|
-
|
146
|
+
success_count = 0
|
147
|
+
error_count = 0
|
151
148
|
for sensor in self._new_sensors[:]:
|
152
149
|
try:
|
153
|
-
|
154
|
-
|
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")
|
155
153
|
self._new_sensors.remove(sensor)
|
156
|
-
|
157
|
-
except Exception
|
158
|
-
|
159
|
-
|
160
|
-
|
154
|
+
success_count += 1
|
155
|
+
except Exception: # pylint: disable=broad-exception-caught
|
156
|
+
error_count += 1
|
157
|
+
if error_count > 0:
|
158
|
+
_LOGGER.warning(
|
159
|
+
"Failed to add %s sensors for device %s",
|
160
|
+
error_count,
|
161
161
|
self.device_id,
|
162
|
-
err,
|
163
162
|
)
|
164
|
-
return
|
163
|
+
return success_count
|
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
|