aioccl 2024.12.5__tar.gz → 2024.12.7__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-2024.12.5 → aioccl-2024.12.7}/PKG-INFO +1 -1
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl/device.py +16 -11
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl/sensor.py +6 -7
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl/server.py +0 -1
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl.egg-info/PKG-INFO +1 -1
- {aioccl-2024.12.5 → aioccl-2024.12.7}/setup.py +1 -1
- {aioccl-2024.12.5 → aioccl-2024.12.7}/LICENSE +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/README.md +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl/__init__.py +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl.egg-info/SOURCES.txt +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl.egg-info/dependency_links.txt +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl.egg-info/requires.txt +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/aioccl.egg-info/top_level.txt +0 -0
- {aioccl-2024.12.5 → aioccl-2024.12.7}/setup.cfg +0 -0
@@ -16,21 +16,21 @@ CCL_DEVICE_INFO_TYPES = ("serial_no", "mac_address", "model", "fw_ver")
|
|
16
16
|
class CCLDevice:
|
17
17
|
"""Mapping for a CCL device."""
|
18
18
|
_binary_sensors: dict[str, CCLSensor] | None = {}
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
_device_id: str | None = None
|
20
|
+
_fw_ver: str | None = None
|
21
|
+
_last_updated_time: float | None = None
|
22
|
+
_mac_address: str | None = None
|
23
|
+
_model: str | None = None
|
23
24
|
_new_binary_sensor_callbacks = set()
|
24
25
|
_new_sensors: list[CCLSensor] | None = []
|
25
26
|
_new_sensor_callbacks = set()
|
27
|
+
_passkey = ''
|
26
28
|
_sensors: dict[str, CCLSensor] | None = {}
|
27
|
-
_serial_no: str | None
|
28
|
-
_update_callbacks = set()
|
29
|
-
|
29
|
+
_serial_no: str | None = None
|
30
|
+
_update_callbacks = set()
|
30
31
|
|
31
32
|
def __init__(self, passkey: str):
|
32
33
|
"""Initialize a CCL device."""
|
33
|
-
_LOGGER.debug("Initializing CCL Device: %s", self)
|
34
34
|
self._passkey = passkey
|
35
35
|
|
36
36
|
@property
|
@@ -41,12 +41,18 @@ class CCLDevice:
|
|
41
41
|
@property
|
42
42
|
def device_id(self) -> str | None:
|
43
43
|
"""Return the device ID."""
|
44
|
-
|
44
|
+
try:
|
45
|
+
self._device_id = self._mac_address.replace(":", "").lower()[-6:]
|
46
|
+
except Exception: # pylint: disable=broad-exception-caught
|
47
|
+
return None
|
48
|
+
return self._device_id
|
45
49
|
|
46
50
|
@property
|
47
51
|
def name(self) -> str | None:
|
48
52
|
"""Return the display name."""
|
49
|
-
|
53
|
+
if self._device_id is not None:
|
54
|
+
return self._model + " - " + self._device_id
|
55
|
+
return self._model
|
50
56
|
|
51
57
|
@property
|
52
58
|
def mac_address(self) -> str | None:
|
@@ -133,7 +139,6 @@ class CCLDevice:
|
|
133
139
|
"""Schedule call all registered callbacks."""
|
134
140
|
for sensor in self._new_sensors[:]:
|
135
141
|
try:
|
136
|
-
_LOGGER.debug("Publishing new sensor: %s", sensor)
|
137
142
|
if sensor.binary:
|
138
143
|
for callback in self._new_binary_sensor_callbacks:
|
139
144
|
callback(sensor)
|
@@ -34,8 +34,9 @@ class CCLSensor:
|
|
34
34
|
@property
|
35
35
|
def compartment(self) -> None | str:
|
36
36
|
"""Decide which compartment it belongs to."""
|
37
|
-
if CCL_SENSORS[self._key].compartment:
|
37
|
+
if CCL_SENSORS[self._key].compartment in CCLDeviceCompartment:
|
38
38
|
return CCL_SENSORS[self._key].compartment.value
|
39
|
+
return None
|
39
40
|
|
40
41
|
@property
|
41
42
|
def binary(self) -> bool:
|
@@ -47,14 +48,12 @@ class CCLSensor:
|
|
47
48
|
"""Return the intrinsic sensor value."""
|
48
49
|
if self.sensor_type.name in CCL_SENSOR_VALUES:
|
49
50
|
return CCL_SENSOR_VALUES[self.sensor_type.name].get(self._value)
|
50
|
-
|
51
|
+
if self.sensor_type == CCLSensorTypes.BATTERY_BINARY:
|
51
52
|
try:
|
52
|
-
|
53
|
-
return x
|
53
|
+
return int(self._value) - 1
|
54
54
|
except ValueError:
|
55
55
|
pass
|
56
|
-
|
57
|
-
return self._value
|
56
|
+
return self._value
|
58
57
|
|
59
58
|
@value.setter
|
60
59
|
def value(self, new_value):
|
@@ -67,7 +66,7 @@ class CCLSensorPreset:
|
|
67
66
|
|
68
67
|
name: str
|
69
68
|
sensor_type: str
|
70
|
-
compartment:
|
69
|
+
compartment: CCLDeviceCompartment | None = None
|
71
70
|
binary: bool = False
|
72
71
|
|
73
72
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|