aioccl 2024.8.3__py3-none-any.whl → 2024.8.5__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 +1 -1
- aioccl/sensor.py +15 -8
- {aioccl-2024.8.3.dist-info → aioccl-2024.8.5.dist-info}/METADATA +1 -1
- aioccl-2024.8.5.dist-info/RECORD +9 -0
- aioccl-2024.8.3.dist-info/RECORD +0 -9
- {aioccl-2024.8.3.dist-info → aioccl-2024.8.5.dist-info}/LICENSE +0 -0
- {aioccl-2024.8.3.dist-info → aioccl-2024.8.5.dist-info}/WHEEL +0 -0
- {aioccl-2024.8.3.dist-info → aioccl-2024.8.5.dist-info}/top_level.txt +0 -0
aioccl/device.py
CHANGED
@@ -72,7 +72,7 @@ class CCLDevice:
|
|
72
72
|
self._serial_no = info.get('serial_no')
|
73
73
|
self._mac_address = info.get('mac_address')
|
74
74
|
self._model = info.get('model')
|
75
|
-
self.
|
75
|
+
self._fw_ver = info.get('fw_ver')
|
76
76
|
|
77
77
|
def update_sensors(self, sensors: dict[str, None | str | int | float]) -> None:
|
78
78
|
"""Add or update all sensor values."""
|
aioccl/sensor.py
CHANGED
@@ -9,7 +9,7 @@ class CCLSensor:
|
|
9
9
|
|
10
10
|
def __init__(self, key: str):
|
11
11
|
"""Initialize a CCL sensor."""
|
12
|
-
self._value: None | str | int | float
|
12
|
+
self._value: None | str | int | float = None
|
13
13
|
|
14
14
|
if key in CCL_SENSORS.keys():
|
15
15
|
self._key = key
|
@@ -27,20 +27,27 @@ class CCLSensor:
|
|
27
27
|
return CCL_SENSORS[self._key].sensor_type
|
28
28
|
|
29
29
|
@property
|
30
|
-
def compartment(self) -> str:
|
31
|
-
|
30
|
+
def compartment(self) -> None | str:
|
31
|
+
if CCL_SENSORS[self._key].compartment is not None:
|
32
|
+
return CCL_SENSORS[self._key].compartment.value
|
32
33
|
|
33
34
|
@property
|
34
35
|
def binary(self) -> bool:
|
35
36
|
return CCL_SENSORS[self._key].binary
|
36
37
|
|
37
38
|
@property
|
38
|
-
def value(self):
|
39
|
+
def value(self) -> None | str | int | float:
|
39
40
|
if self.sensor_type == CCLSensorTypes.CH_SENSOR_TYPE:
|
40
41
|
return CCL_CH_SENSOR_TYPES.get(self._value)
|
41
42
|
elif self.sensor_type in CCL_LEVEL_SENSORS:
|
42
43
|
return 'Lv ' + self._value
|
43
|
-
|
44
|
+
try:
|
45
|
+
return int(self._value)
|
46
|
+
except ValueError:
|
47
|
+
try:
|
48
|
+
return float(self._value)
|
49
|
+
except ValueError:
|
50
|
+
return self._value
|
44
51
|
|
45
52
|
@value.setter
|
46
53
|
def value(self, new_value):
|
@@ -50,7 +57,7 @@ class CCLSensor:
|
|
50
57
|
class CCLSensorPreset:
|
51
58
|
name: str
|
52
59
|
sensor_type: str
|
53
|
-
compartment:
|
60
|
+
compartment: None | CCLDeviceCompartment = None
|
54
61
|
binary: bool = False
|
55
62
|
|
56
63
|
class CCLSensorTypes(enum.Enum):
|
@@ -152,8 +159,8 @@ CCL_SENSORS: dict[str, CCLSensorPreset] = {
|
|
152
159
|
't234c7bat': CCLSensorPreset('Battery: CH7', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
153
160
|
't11bat': CCLSensorPreset('Battery: CO', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
154
161
|
't10bat': CCLSensorPreset('Battery: CO\u2082', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
155
|
-
'inbat': CCLSensorPreset('Battery: Console', CCLSensorTypes.BATTERY_BINARY, True),
|
156
|
-
't9bat': CCLSensorPreset('Battery:Formaldehyde/VOC', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
162
|
+
'inbat': CCLSensorPreset('Battery: Console', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
163
|
+
't9bat': CCLSensorPreset('Battery: Formaldehyde/VOC', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
157
164
|
't6c1bat': CCLSensorPreset('Battery: Leakage CH1', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
158
165
|
't1bat': CCLSensorPreset('Battery: Main Sensor Array', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
159
166
|
't8bat': CCLSensorPreset('Battery: PM2.5/10', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
@@ -0,0 +1,9 @@
|
|
1
|
+
aioccl/__init__.py,sha256=iL1OC2F_rf3qkswi-bO8Y_uj2-lf284LCnyxwqdLUU8,137
|
2
|
+
aioccl/device.py,sha256=Cr33h7HrM2YS-u9BxoJASd2X5nBba37_fC85XunhVcs,5132
|
3
|
+
aioccl/sensor.py,sha256=JGYiTbKMJSqjDmxIiRUb3CWU8o7Is7h49iVwoYANHzA,10629
|
4
|
+
aioccl/server.py,sha256=-ZDii20CLqj4_jqVVqRMlnvg-CCtJiZjuMMDamem0DE,3717
|
5
|
+
aioccl-2024.8.5.dist-info/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
+
aioccl-2024.8.5.dist-info/METADATA,sha256=NaIY0V17xuYQcsH12ZIcZrPrWG1JbLg6nXJ4NGSwbio,769
|
7
|
+
aioccl-2024.8.5.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
8
|
+
aioccl-2024.8.5.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
+
aioccl-2024.8.5.dist-info/RECORD,,
|
aioccl-2024.8.3.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
aioccl/__init__.py,sha256=iL1OC2F_rf3qkswi-bO8Y_uj2-lf284LCnyxwqdLUU8,137
|
2
|
-
aioccl/device.py,sha256=OIUzb4wpADkbAekpWKYXCVoigNlLA-3W8aRnxHAN9D8,5134
|
3
|
-
aioccl/sensor.py,sha256=acEWOlQVkcxBIas7LQkbVd-VpdH2wohOo-lS5gTpPk0,10296
|
4
|
-
aioccl/server.py,sha256=-ZDii20CLqj4_jqVVqRMlnvg-CCtJiZjuMMDamem0DE,3717
|
5
|
-
aioccl-2024.8.3.dist-info/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
-
aioccl-2024.8.3.dist-info/METADATA,sha256=Sjg1FWskDNmi2B8198g4FQYb5VZ681A7fe93q3g2zwg,769
|
7
|
-
aioccl-2024.8.3.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
8
|
-
aioccl-2024.8.3.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
-
aioccl-2024.8.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|