pyimouapi 1.0.4.2__tar.gz → 1.0.4.4__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.
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/PKG-INFO +1 -1
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/const.py +26 -40
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/ha_device.py +8 -5
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi.egg-info/PKG-INFO +1 -1
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/setup.py +1 -1
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/LICENSE +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/README.md +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/__init__.py +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/device.py +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/exceptions.py +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi/openapi.py +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi.egg-info/SOURCES.txt +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi.egg-info/dependency_links.txt +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/pyimouapi.egg-info/top_level.txt +0 -0
- {pyimouapi-1.0.4.2 → pyimouapi-1.0.4.4}/setup.cfg +0 -0
|
@@ -86,7 +86,6 @@ PARAM_HLS = "hls"
|
|
|
86
86
|
PARAM_URL = "url"
|
|
87
87
|
PARAM_KEY = "key"
|
|
88
88
|
PARAM_DEFAULT = "default"
|
|
89
|
-
PARAM_UNIT = "unit"
|
|
90
89
|
PARAM_REF = "ref"
|
|
91
90
|
PARAM_CONTENT = "content"
|
|
92
91
|
PARAM_ON = "on"
|
|
@@ -126,7 +125,7 @@ SELECT_TYPE_ABILITY = {
|
|
|
126
125
|
# Required capacity for various sensor types
|
|
127
126
|
SENSOR_TYPE_ABILITY = {
|
|
128
127
|
"storage_used": ["LocalStorage", "LocalStorageEnable"],
|
|
129
|
-
"
|
|
128
|
+
"battery": ["Electric"],
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
# Levels of capacity
|
|
@@ -169,7 +168,7 @@ BUTTON_TYPE_PARAM_VALUE = {
|
|
|
169
168
|
THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
170
169
|
"z76s20l415gnhhl1": {
|
|
171
170
|
"button_type_ref": {
|
|
172
|
-
"
|
|
171
|
+
"restart_device": {"ref": "2300", "type": "service"},
|
|
173
172
|
"mute": {"ref": "21600", "type": "service"},
|
|
174
173
|
},
|
|
175
174
|
"switch_type_ref": {
|
|
@@ -223,21 +222,19 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
223
222
|
},
|
|
224
223
|
"qfwybtpd03zxiyxi": {
|
|
225
224
|
"sensor_type_ref": {
|
|
226
|
-
"
|
|
225
|
+
"battery": {
|
|
227
226
|
"ref": "11600",
|
|
228
227
|
"type": "property",
|
|
229
|
-
"default": 15,
|
|
230
|
-
"unit": "%",
|
|
228
|
+
"default": "15",
|
|
231
229
|
}
|
|
232
230
|
},
|
|
233
231
|
},
|
|
234
232
|
"FNXACFDW": {
|
|
235
233
|
"sensor_type_ref": {
|
|
236
|
-
"
|
|
234
|
+
"battery": {
|
|
237
235
|
"ref": "11600",
|
|
238
236
|
"type": "property",
|
|
239
|
-
"default": 15,
|
|
240
|
-
"unit": "%",
|
|
237
|
+
"default": "15",
|
|
241
238
|
}
|
|
242
239
|
},
|
|
243
240
|
},
|
|
@@ -256,11 +253,10 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
256
253
|
},
|
|
257
254
|
"emi4a5sapwg0pnj0": {
|
|
258
255
|
"sensor_type_ref": {
|
|
259
|
-
"
|
|
256
|
+
"battery": {
|
|
260
257
|
"ref": "11600",
|
|
261
258
|
"type": "property",
|
|
262
|
-
"default": 15,
|
|
263
|
-
"unit": "%",
|
|
259
|
+
"default": "15",
|
|
264
260
|
}
|
|
265
261
|
},
|
|
266
262
|
"button_type_ref": {
|
|
@@ -269,11 +265,10 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
269
265
|
},
|
|
270
266
|
"BZFACWD1": {
|
|
271
267
|
"sensor_type_ref": {
|
|
272
|
-
"
|
|
268
|
+
"battery": {
|
|
273
269
|
"ref": "11600",
|
|
274
270
|
"type": "property",
|
|
275
|
-
"default": 15,
|
|
276
|
-
"unit": "%",
|
|
271
|
+
"default": "15",
|
|
277
272
|
}
|
|
278
273
|
},
|
|
279
274
|
"button_type_ref": {
|
|
@@ -282,11 +277,10 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
282
277
|
},
|
|
283
278
|
"W53ATH8Y": {
|
|
284
279
|
"sensor_type_ref": {
|
|
285
|
-
"
|
|
280
|
+
"battery": {
|
|
286
281
|
"ref": "11600",
|
|
287
282
|
"type": "property",
|
|
288
|
-
"default": 15,
|
|
289
|
-
"unit": "%",
|
|
283
|
+
"default": "15",
|
|
290
284
|
}
|
|
291
285
|
},
|
|
292
286
|
"switch_type_ref": {
|
|
@@ -299,11 +293,10 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
299
293
|
},
|
|
300
294
|
"qlkc2jscyskjl2l0": {
|
|
301
295
|
"sensor_type_ref": {
|
|
302
|
-
"
|
|
296
|
+
"battery": {
|
|
303
297
|
"ref": "11600",
|
|
304
298
|
"type": "property",
|
|
305
|
-
"default": 15,
|
|
306
|
-
"unit": "%",
|
|
299
|
+
"default": "15",
|
|
307
300
|
}
|
|
308
301
|
},
|
|
309
302
|
"switch_type_ref": {
|
|
@@ -316,43 +309,38 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
316
309
|
},
|
|
317
310
|
"XQA32TH3": {
|
|
318
311
|
"sensor_type_ref": {
|
|
319
|
-
"
|
|
312
|
+
"battery": {
|
|
320
313
|
"ref": "11600",
|
|
321
314
|
"type": "property",
|
|
322
|
-
"default": 15,
|
|
323
|
-
"unit": "%",
|
|
315
|
+
"default": "15",
|
|
324
316
|
}
|
|
325
317
|
},
|
|
326
318
|
},
|
|
327
319
|
"ilgltwx0a0x7rykg": {
|
|
328
320
|
"sensor_type_ref": {
|
|
329
|
-
"
|
|
321
|
+
"battery": {
|
|
330
322
|
"ref": "11600",
|
|
331
323
|
"type": "property",
|
|
332
|
-
"default": 15,
|
|
333
|
-
"unit": "%",
|
|
324
|
+
"default": "15",
|
|
334
325
|
}
|
|
335
326
|
},
|
|
336
327
|
},
|
|
337
328
|
"jp6he4js8mu0u37d": {
|
|
338
329
|
"sensor_type_ref": {
|
|
339
|
-
"
|
|
330
|
+
"battery": {
|
|
340
331
|
"ref": "11600",
|
|
341
332
|
"type": "property",
|
|
342
|
-
"default": 15,
|
|
343
|
-
"unit": "%",
|
|
333
|
+
"default": "15",
|
|
344
334
|
},
|
|
345
335
|
"temperature_current": {
|
|
346
336
|
"ref": "11700",
|
|
347
337
|
"type": "property",
|
|
348
|
-
"default": 10,
|
|
349
|
-
"unit": "°C",
|
|
338
|
+
"default": "10",
|
|
350
339
|
},
|
|
351
340
|
"humidity_current": {
|
|
352
341
|
"ref": "16100",
|
|
353
342
|
"type": "property",
|
|
354
|
-
"default": 10,
|
|
355
|
-
"unit": "%RH",
|
|
343
|
+
"default": "10",
|
|
356
344
|
},
|
|
357
345
|
},
|
|
358
346
|
},
|
|
@@ -363,21 +351,19 @@ THINGS_MODEL_PRODUCT_TYPE_REF = {
|
|
|
363
351
|
},
|
|
364
352
|
"zfdw8yfg3d94bbos": {
|
|
365
353
|
"sensor_type_ref": {
|
|
366
|
-
"
|
|
354
|
+
"battery": {
|
|
367
355
|
"ref": "11600",
|
|
368
356
|
"type": "property",
|
|
369
|
-
"default": 15,
|
|
370
|
-
"unit": "%",
|
|
357
|
+
"default": "15",
|
|
371
358
|
}
|
|
372
359
|
},
|
|
373
360
|
},
|
|
374
361
|
"1TUJJFGY": {
|
|
375
362
|
"sensor_type_ref": {
|
|
376
|
-
"
|
|
363
|
+
"battery": {
|
|
377
364
|
"ref": "11600",
|
|
378
365
|
"type": "property",
|
|
379
|
-
"default": 15,
|
|
380
|
-
"unit": "%",
|
|
366
|
+
"default": "15",
|
|
381
367
|
}
|
|
382
368
|
},
|
|
383
369
|
},
|
|
@@ -29,7 +29,6 @@ from .const import (
|
|
|
29
29
|
BUTTON_TYPE_ABILITY,
|
|
30
30
|
THINGS_MODEL_PRODUCT_TYPE_REF,
|
|
31
31
|
PARAM_DEFAULT,
|
|
32
|
-
PARAM_UNIT,
|
|
33
32
|
PARAM_PROPERTIES,
|
|
34
33
|
PARAM_REF,
|
|
35
34
|
ERROR_CODE_NO_STORAGE_MEDIUM,
|
|
@@ -133,6 +132,10 @@ class ImouHaDevice(object):
|
|
|
133
132
|
def things_model(self) -> bool:
|
|
134
133
|
return self._things_model
|
|
135
134
|
|
|
135
|
+
@property
|
|
136
|
+
def device_name(self) -> str:
|
|
137
|
+
return self._device_name
|
|
138
|
+
|
|
136
139
|
def set_product_id(self, product_id: str) -> None:
|
|
137
140
|
self._product_id = product_id
|
|
138
141
|
|
|
@@ -241,7 +244,7 @@ class ImouHaDeviceManager(object):
|
|
|
241
244
|
percentage_used = int(
|
|
242
245
|
data[PARAM_USED_BYTES] * 100 / data[PARAM_TOTAL_BYTES]
|
|
243
246
|
)
|
|
244
|
-
device.sensors[PARAM_STORAGE_USED] =
|
|
247
|
+
device.sensors[PARAM_STORAGE_USED] = percentage_used
|
|
245
248
|
else:
|
|
246
249
|
device.sensors[PARAM_STORAGE_USED] = "No Storage Medium"
|
|
247
250
|
except RequestFailedException as exception:
|
|
@@ -622,7 +625,7 @@ class ImouHaDeviceManager(object):
|
|
|
622
625
|
for key, value in THINGS_MODEL_PRODUCT_TYPE_REF[product_id][
|
|
623
626
|
PARAM_SENSOR_TYPE_REF
|
|
624
627
|
].items():
|
|
625
|
-
imou_ha_device.sensors[key] = value[PARAM_DEFAULT]
|
|
628
|
+
imou_ha_device.sensors[key] = value[PARAM_DEFAULT]
|
|
626
629
|
|
|
627
630
|
async def _async_update_device_switch_status_by_ref(self, device, switch_type):
|
|
628
631
|
# 获取开关类型
|
|
@@ -704,13 +707,13 @@ class ImouHaDeviceManager(object):
|
|
|
704
707
|
device_id, device.product_id, [sensor[PARAM_REF]]
|
|
705
708
|
)
|
|
706
709
|
device.sensors[sensor_type] = (
|
|
707
|
-
data[PARAM_PROPERTIES][sensor[PARAM_REF]]
|
|
710
|
+
data[PARAM_PROPERTIES][sensor[PARAM_REF]]
|
|
708
711
|
if sensor[PARAM_REF] in data[PARAM_PROPERTIES]
|
|
709
712
|
else sensor[PARAM_DEFAULT]
|
|
710
713
|
)
|
|
711
714
|
except Exception as e:
|
|
712
715
|
_LOGGER.warning(f"_async_update_device_sensor_status_by_ref fail:{e}")
|
|
713
|
-
device.sensors[sensor_type] = sensor[PARAM_DEFAULT]
|
|
716
|
+
device.sensors[sensor_type] = sensor[PARAM_DEFAULT]
|
|
714
717
|
|
|
715
718
|
async def _async_press_button_by_ref(self, device, button_type):
|
|
716
719
|
button = THINGS_MODEL_PRODUCT_TYPE_REF[device.product_id][
|
|
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
|