aioccl 2024.7.7__py3-none-any.whl → 2024.8.1__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 +8 -4
- aioccl/sensor.py +105 -34
- aioccl/server.py +3 -2
- {aioccl-2024.7.7.dist-info → aioccl-2024.8.1.dist-info}/METADATA +1 -1
- aioccl-2024.8.1.dist-info/RECORD +9 -0
- {aioccl-2024.7.7.dist-info → aioccl-2024.8.1.dist-info}/WHEEL +1 -1
- aioccl-2024.7.7.dist-info/RECORD +0 -9
- {aioccl-2024.7.7.dist-info → aioccl-2024.8.1.dist-info}/LICENSE +0 -0
- {aioccl-2024.7.7.dist-info → aioccl-2024.8.1.dist-info}/top_level.txt +0 -0
aioccl/device.py
CHANGED
@@ -20,7 +20,7 @@ class CCLDevice:
|
|
20
20
|
self._serial_no: str | None
|
21
21
|
self._mac_address: str | None
|
22
22
|
self._model: str | None
|
23
|
-
self.
|
23
|
+
self._fw_ver: str | None
|
24
24
|
self._binary_sensors: dict[str, CCLSensor] | None = {}
|
25
25
|
self._sensors: dict[str, CCLSensor] | None = {}
|
26
26
|
self._last_updated_time: float | None
|
@@ -39,6 +39,10 @@ class CCLDevice:
|
|
39
39
|
def device_id(self) -> str | None:
|
40
40
|
return self._mac_address.replace(":", "").lower()[-6:]
|
41
41
|
|
42
|
+
@property
|
43
|
+
def name(self) -> str | None:
|
44
|
+
return self._model + " - " + self.device_id
|
45
|
+
|
42
46
|
@property
|
43
47
|
def serial_no(self) -> str | None:
|
44
48
|
return self._serial_no
|
@@ -52,8 +56,8 @@ class CCLDevice:
|
|
52
56
|
return self._model
|
53
57
|
|
54
58
|
@property
|
55
|
-
def
|
56
|
-
return self.
|
59
|
+
def fw_ver(self) -> str | None:
|
60
|
+
return self._fw_ver
|
57
61
|
|
58
62
|
@property
|
59
63
|
def binary_sensors(self) -> dict[str, CCLSensor] | None:
|
@@ -122,7 +126,7 @@ class CCLDevice:
|
|
122
126
|
|
123
127
|
def _publish_new_sensors(self) -> None:
|
124
128
|
"""Schedule call all registered callbacks."""
|
125
|
-
for sensor in self._new_sensors:
|
129
|
+
for sensor in self._new_sensors[:]:
|
126
130
|
try:
|
127
131
|
_LOGGER.debug("Publishing new sensor: %s", sensor)
|
128
132
|
if sensor.binary:
|
aioccl/sensor.py
CHANGED
@@ -26,6 +26,10 @@ class CCLSensor:
|
|
26
26
|
def sensor_type(self) -> CCLSensorTypes:
|
27
27
|
return CCL_SENSORS[self._key].sensor_type
|
28
28
|
|
29
|
+
@property
|
30
|
+
def compartment(self) -> str:
|
31
|
+
return CCL_SENSORS[self._key].compartment.value
|
32
|
+
|
29
33
|
@property
|
30
34
|
def binary(self) -> bool:
|
31
35
|
return CCL_SENSORS[self._key].binary
|
@@ -33,7 +37,9 @@ class CCLSensor:
|
|
33
37
|
@property
|
34
38
|
def value(self):
|
35
39
|
if self.sensor_type == CCLSensorTypes.CH_SENSOR_TYPE:
|
36
|
-
return CCL_CH_SENSOR_TYPES
|
40
|
+
return CCL_CH_SENSOR_TYPES.get(self._value)
|
41
|
+
elif self.sensor_type == CCLSensorTypes.VOC:
|
42
|
+
return 'Lv ' + self._value
|
37
43
|
return self._value
|
38
44
|
|
39
45
|
@value.setter
|
@@ -44,6 +50,7 @@ class CCLSensor:
|
|
44
50
|
class CCLSensorPreset:
|
45
51
|
name: str
|
46
52
|
sensor_type: str
|
53
|
+
compartment: str
|
47
54
|
binary: bool = False
|
48
55
|
|
49
56
|
class CCLSensorTypes(enum.Enum):
|
@@ -59,43 +66,107 @@ class CCLSensorTypes(enum.Enum):
|
|
59
66
|
BATTERY_BINARY = 10
|
60
67
|
CONNECTION = 11
|
61
68
|
CH_SENSOR_TYPE = 12
|
62
|
-
|
63
|
-
|
69
|
+
CO = 13
|
70
|
+
CO2 = 14
|
71
|
+
VOLATILE = 15
|
72
|
+
VOC = 16
|
73
|
+
PM10 = 17
|
74
|
+
PM25 = 18
|
75
|
+
AQI = 19
|
76
|
+
LEAKAGE = 20
|
77
|
+
BATTERY = 21
|
78
|
+
|
79
|
+
class CCLDeviceCompartment(enum.Enum):
|
80
|
+
ADDITIONAL = 'Additional Sensors'
|
81
|
+
STATUS = 'Status'
|
82
|
+
|
83
|
+
CCL_CH_SENSOR_TYPES: dict[str, str] = {
|
84
|
+
'2': 'Thermo-Hygro',
|
85
|
+
'3': 'Pool',
|
86
|
+
'4': 'Soil',
|
87
|
+
}
|
64
88
|
|
65
89
|
CCL_SENSORS: dict[str, CCLSensorPreset] = {
|
66
|
-
|
67
|
-
'abar': CCLSensorPreset('
|
68
|
-
'
|
90
|
+
# Main Sensors 12-34
|
91
|
+
'abar': CCLSensorPreset('Air Pressure (Absolute)', CCLSensorTypes.PRESSURE),
|
92
|
+
'rbar': CCLSensorPreset('Air Pressure (Relative)', CCLSensorTypes.PRESSURE),
|
93
|
+
't1dew': CCLSensorPreset('Index: Dew Point', CCLSensorTypes.TEMPERATURE),
|
94
|
+
't1feels': CCLSensorPreset('Index: Feels Like', CCLSensorTypes.TEMPERATURE),
|
95
|
+
't1heat': CCLSensorPreset('Index: Heat Index', CCLSensorTypes.TEMPERATURE),
|
96
|
+
't1wbgt': CCLSensorPreset('Index: WBGT', CCLSensorTypes.TEMPERATURE),
|
97
|
+
't1chill': CCLSensorPreset('Index: Wind Chill', CCLSensorTypes.TEMPERATURE),
|
69
98
|
'inhum': CCLSensorPreset('Indoor Humidity', CCLSensorTypes.HUMIDITY),
|
70
|
-
'
|
71
|
-
'
|
99
|
+
'intem': CCLSensorPreset('Indoor Temperature', CCLSensorTypes.TEMPERATURE),
|
100
|
+
't1solrad': CCLSensorPreset('Light Intensity', CCLSensorTypes.RADIATION),
|
72
101
|
't1hum': CCLSensorPreset('Outdoor Humidity', CCLSensorTypes.HUMIDITY),
|
73
|
-
'
|
74
|
-
't1ws': CCLSensorPreset('Wind Speed', CCLSensorTypes.WIND_SPEED),
|
75
|
-
't1ws10mav': CCLSensorPreset('Wind Speed (10 mins avg.)', CCLSensorTypes.WIND_SPEED),
|
76
|
-
't1wgust': CCLSensorPreset('Wind Gust', CCLSensorTypes.WIND_SPEED),
|
102
|
+
't1tem': CCLSensorPreset('Outdoor Temperature', CCLSensorTypes.TEMPERATURE),
|
77
103
|
't1rainra': CCLSensorPreset('Rain Rate', CCLSensorTypes.RAIN_RATE),
|
78
|
-
't1rainhr': CCLSensorPreset('Hourly
|
79
|
-
't1raindy': CCLSensorPreset('Daily
|
80
|
-
't1rainwy': CCLSensorPreset('Weekly
|
81
|
-
't1rainmth': CCLSensorPreset('Monthly
|
104
|
+
't1rainhr': CCLSensorPreset('Rainfall: Hourly ', CCLSensorTypes.RAINFALL),
|
105
|
+
't1raindy': CCLSensorPreset('Rainfall: Daily', CCLSensorTypes.RAINFALL),
|
106
|
+
't1rainwy': CCLSensorPreset('Rainfall: Weekly', CCLSensorTypes.RAINFALL),
|
107
|
+
't1rainmth': CCLSensorPreset('Rainfall: Monthly', CCLSensorTypes.RAINFALL),
|
82
108
|
't1uvi': CCLSensorPreset('UV Index', CCLSensorTypes.UVI),
|
83
|
-
'
|
84
|
-
'
|
85
|
-
'
|
86
|
-
'
|
87
|
-
|
88
|
-
'
|
89
|
-
'
|
90
|
-
'
|
91
|
-
'
|
92
|
-
'
|
93
|
-
'
|
94
|
-
'
|
95
|
-
'
|
96
|
-
'
|
97
|
-
'
|
98
|
-
'
|
99
|
-
'
|
100
|
-
'
|
109
|
+
't1wdir': CCLSensorPreset('Wind Direction', CCLSensorTypes.WIND_DIRECITON),
|
110
|
+
't1wgust': CCLSensorPreset('Wind Gust', CCLSensorTypes.WIND_SPEED),
|
111
|
+
't1ws': CCLSensorPreset('Wind Speed', CCLSensorTypes.WIND_SPEED),
|
112
|
+
't1ws10mav': CCLSensorPreset('Wind Speed (10 mins AVG.)', CCLSensorTypes.WIND_SPEED),
|
113
|
+
# Additional Sensors 35-77
|
114
|
+
't11co': CCLSensorPreset('Air quality: CO', CCLSensorTypes.CO, CCLDeviceCompartment.ADDITIONAL),
|
115
|
+
't10co2': CCLSensorPreset('Air quality: CO\u2082', CCLSensorTypes.CO2, CCLDeviceCompartment.ADDITIONAL),
|
116
|
+
't9hcho': CCLSensorPreset('Air quality: Formaldehyde', CCLSensorTypes.VOLATILE, CCLDeviceCompartment.ADDITIONAL),
|
117
|
+
't8pm10': CCLSensorPreset('Air quality: PM10', CCLSensorTypes.PM10, CCLDeviceCompartment.ADDITIONAL),
|
118
|
+
't8pm10ai': CCLSensorPreset('Air quality: PM10 AQI', CCLSensorTypes.AQI, CCLDeviceCompartment.ADDITIONAL),
|
119
|
+
't8pm25': CCLSensorPreset('Air quality: PM2.5', CCLSensorTypes.PM25, CCLDeviceCompartment.ADDITIONAL),
|
120
|
+
't8pm25ai': CCLSensorPreset('Air quality: PM2.5 AQI', CCLSensorTypes.AQI, CCLDeviceCompartment.ADDITIONAL),
|
121
|
+
't9voclv': CCLSensorPreset('Air quality: VOC Level', CCLSensorTypes.VOC, CCLDeviceCompartment.ADDITIONAL),
|
122
|
+
't234c1tem': CCLSensorPreset('CH1 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
123
|
+
't234c1hum': CCLSensorPreset('CH1 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
124
|
+
't234c1tp': CCLSensorPreset('CH1 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
125
|
+
't234c2tem': CCLSensorPreset('CH2 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
126
|
+
't234c2hum': CCLSensorPreset('CH2 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
127
|
+
't234c2tp': CCLSensorPreset('CH2 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
128
|
+
't234c3tem': CCLSensorPreset('CH3 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
129
|
+
't234c3hum': CCLSensorPreset('CH3 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
130
|
+
't234c3tp': CCLSensorPreset('CH3 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
131
|
+
't234c4tem': CCLSensorPreset('CH4 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
132
|
+
't234c4hum': CCLSensorPreset('CH4 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
133
|
+
't234c4tp': CCLSensorPreset('CH4 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
134
|
+
't234c5tem': CCLSensorPreset('CH5 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
135
|
+
't234c5hum': CCLSensorPreset('CH5 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
136
|
+
't234c5tp': CCLSensorPreset('CH5 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
137
|
+
't234c6tem': CCLSensorPreset('CH6 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
138
|
+
't234c6hum': CCLSensorPreset('CH6 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
139
|
+
't234c6tp': CCLSensorPreset('CH6 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
140
|
+
't234c7tem': CCLSensorPreset('CH7 Temperature', CCLSensorTypes.TEMPERATURE, CCLDeviceCompartment.ADDITIONAL),
|
141
|
+
't234c7hum': CCLSensorPreset('CH7 Humidity', CCLSensorTypes.HUMIDITY, CCLDeviceCompartment.ADDITIONAL),
|
142
|
+
't234c7tp': CCLSensorPreset('CH7 Type', CCLSensorTypes.CH_SENSOR_TYPE, CCLDeviceCompartment.ADDITIONAL),
|
143
|
+
't6c1wls': CCLSensorPreset('Leakage CH1', CCLSensorTypes.LEAKAGE, CCLDeviceCompartment.ADDITIONAL, True),
|
144
|
+
# Status 78-119
|
145
|
+
't234c1bat': CCLSensorPreset('Battery: CH1', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
146
|
+
't234c2bat': CCLSensorPreset('Battery: CH2', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
147
|
+
't234c3bat': CCLSensorPreset('Battery: CH3', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
148
|
+
't234c4bat': CCLSensorPreset('Battery: CH4', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
149
|
+
't234c5bat': CCLSensorPreset('Battery: CH5', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
150
|
+
't234c6bat': CCLSensorPreset('Battery: CH6', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
151
|
+
't234c7bat': CCLSensorPreset('Battery: CH7', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
152
|
+
't11bat': CCLSensorPreset('Battery: CO', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
153
|
+
't10bat': CCLSensorPreset('Battery: CO\u2082', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
154
|
+
'inbat': CCLSensorPreset('Battery: Console', CCLSensorTypes.BATTERY_BINARY, True),
|
155
|
+
't9bat': CCLSensorPreset('Battery:Formaldehyde/VOC', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
156
|
+
't6c1bat': CCLSensorPreset('Battery: Leakage CH1', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
157
|
+
't1bat': CCLSensorPreset('Battery: Main Sensor Array', CCLSensorTypes.BATTERY_BINARY, CCLDeviceCompartment.STATUS, True),
|
158
|
+
't8bat': CCLSensorPreset('Battery: PM2.5/10', CCLSensorTypes.BATTERY, CCLDeviceCompartment.STATUS),
|
159
|
+
't234c1cn': CCLSensorPreset('Connection: CH1', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
160
|
+
't234c2cn': CCLSensorPreset('Connection: CH2', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
161
|
+
't234c3cn': CCLSensorPreset('Connection: CH3', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
162
|
+
't234c4cn': CCLSensorPreset('Connection: CH4', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
163
|
+
't234c5cn': CCLSensorPreset('Connection: CH5', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
164
|
+
't234c6cn': CCLSensorPreset('Connection: CH6', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
165
|
+
't234c7cn': CCLSensorPreset('Connection: CH7', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
166
|
+
't11cn': CCLSensorPreset('Connection: CO', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
167
|
+
't10cn': CCLSensorPreset('Connection: CO\u2082', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
168
|
+
't9cn': CCLSensorPreset('Connection: Formaldehyde/VOC', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
169
|
+
't6c1cn': CCLSensorPreset('Connection: Leakage CH1', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
170
|
+
't1cn': CCLSensorPreset('Connection: Main Sensor Array', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
171
|
+
't8cn': CCLSensorPreset('Connection: PM2.5/10', CCLSensorTypes.CONNECTION, CCLDeviceCompartment.STATUS, True),
|
101
172
|
}
|
aioccl/server.py
CHANGED
@@ -22,7 +22,7 @@ class CCLServer:
|
|
22
22
|
CCLServer.devices.setdefault(device.passkey, device)
|
23
23
|
_LOGGER.debug(CCLServer.devices)
|
24
24
|
|
25
|
-
routes = web.RouteTableDef()
|
25
|
+
#routes = web.RouteTableDef()
|
26
26
|
|
27
27
|
async def _handler(request: web.BaseRequest) -> web.Response:
|
28
28
|
"""Handle POST requests for data updating."""
|
@@ -54,6 +54,7 @@ class CCLServer:
|
|
54
54
|
assert 0 < request.content_length <= 5000, 400
|
55
55
|
|
56
56
|
HandlerStorage.body = await request.json()
|
57
|
+
_LOGGER.debug(HandlerStorage.body)
|
57
58
|
|
58
59
|
except Exception as err:
|
59
60
|
_status = err.args[0]
|
@@ -80,7 +81,7 @@ class CCLServer:
|
|
80
81
|
finally:
|
81
82
|
return web.Response(status=_status, text=_text)
|
82
83
|
|
83
|
-
app = web.Application()
|
84
|
+
#app = web.Application()
|
84
85
|
|
85
86
|
cors = aiohttp_cors.setup(app)
|
86
87
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
aioccl/__init__.py,sha256=iL1OC2F_rf3qkswi-bO8Y_uj2-lf284LCnyxwqdLUU8,137
|
2
|
+
aioccl/device.py,sha256=OIUzb4wpADkbAekpWKYXCVoigNlLA-3W8aRnxHAN9D8,5134
|
3
|
+
aioccl/sensor.py,sha256=n23qqqLWk9cjRoC8sAs-iKyXXDfUi9wnDjuN6DWIkW4,10169
|
4
|
+
aioccl/server.py,sha256=MpNuuwQetucypkOko_nfc2xMRj0GTNhJ2xg8SVcfrCQ,3718
|
5
|
+
aioccl-2024.8.1.dist-info/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
+
aioccl-2024.8.1.dist-info/METADATA,sha256=3gZAbk1iqgNz4hMNcdeIrxboHlnUKjtL3Z19XshkZSI,769
|
7
|
+
aioccl-2024.8.1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
8
|
+
aioccl-2024.8.1.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
+
aioccl-2024.8.1.dist-info/RECORD,,
|
aioccl-2024.7.7.dist-info/RECORD
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
aioccl/__init__.py,sha256=iL1OC2F_rf3qkswi-bO8Y_uj2-lf284LCnyxwqdLUU8,137
|
2
|
-
aioccl/device.py,sha256=QKlVZ-Zu7eXOENxdUhOFMW9FojzcELf4-zCNQR8kLMw,5029
|
3
|
-
aioccl/sensor.py,sha256=wDCfGeQnk1FSH7gsM-85vU1-O1j0WDh3hScHRN1agM8,4244
|
4
|
-
aioccl/server.py,sha256=JPwhjp7pzQnm7J2RcHh3GiaqBc-jkRH2mQA4KHJzm28,3669
|
5
|
-
aioccl-2024.7.7.dist-info/LICENSE,sha256=PBRsTHchx7o0TQ2R2ktEAfFmn1iNHTxcOP_xaeuSAuo,11349
|
6
|
-
aioccl-2024.7.7.dist-info/METADATA,sha256=8S_Sn6ZZQgv_atSOHVOAzwlCXst0pbpef5BuKCFdCsw,769
|
7
|
-
aioccl-2024.7.7.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
8
|
-
aioccl-2024.7.7.dist-info/top_level.txt,sha256=-xIJfyfXTaW_EH7XCIHyxjSSSwjLmawa2qhsrHZH1vA,7
|
9
|
-
aioccl-2024.7.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|