blebox-uniapi 2.3.0__tar.gz → 2.4.1__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.
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/HISTORY.rst +12 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/PKG-INFO +14 -1
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/__init__.py +1 -1
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/box.py +3 -88
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/box_types.py +162 -105
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/climate.py +4 -6
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/cover.py +7 -5
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/error.py +1 -38
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/feature.py +2 -1
- blebox_uniapi-2.4.1/blebox_uniapi/jfollow.py +11 -0
- blebox_uniapi-2.4.1/blebox_uniapi/sensor.py +243 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/session.py +2 -2
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi.egg-info/PKG-INFO +14 -1
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi.egg-info/SOURCES.txt +1 -1
- blebox_uniapi-2.4.1/blebox_uniapi.egg-info/requires.txt +2 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/setup.cfg +1 -1
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/setup.py +2 -2
- blebox_uniapi-2.4.1/tests/test_box.py +169 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_box_types.py +11 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_switch.py +144 -160
- blebox_uniapi-2.3.0/blebox_uniapi/sensor.py +0 -231
- blebox_uniapi-2.3.0/blebox_uniapi.egg-info/requires.txt +0 -1
- blebox_uniapi-2.3.0/tests/test_box.py +0 -210
- blebox_uniapi-2.3.0/tests/test_error.py +0 -48
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/CONTRIBUTING.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/LICENSE +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/MANIFEST.in +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/README.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/binary_sensor.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/button.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/light.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi/switch.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi.egg-info/dependency_links.txt +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi.egg-info/not-zip-safe +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/blebox_uniapi.egg-info/top_level.txt +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/Makefile +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/authors.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/conf.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/contributing.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/history.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/index.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/installation.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/make.bat +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/readme.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/docs/usage.rst +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_button.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_climate.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_cover.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_light.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_light_unit.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_sensor.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_session.py +0 -0
- {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.1}/tests/test_unknown.py +0 -0
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
=======
|
|
2
2
|
History
|
|
3
3
|
=======
|
|
4
|
+
2.4.1 (2024-06-04)
|
|
5
|
+
------------------
|
|
6
|
+
* fix: rectify ambiguity around powerConsumption and wind sensor types
|
|
7
|
+
|
|
8
|
+
2.4.0 (2024-06-03)
|
|
9
|
+
------------------
|
|
10
|
+
* Fix: Refactor sensor_factory by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/163
|
|
11
|
+
* Order in BOX_TYPES by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/164
|
|
12
|
+
* Feature: smart meter by @swistakm in https://github.com/blebox/blebox_uniapi/pull/168
|
|
13
|
+
* Smartmeter by @pvsti in https://github.com/blebox/blebox_uniapi/pull/170
|
|
14
|
+
* fix: resolve regressions in cover and climate due to jmespath introduction by @swistakm in https://github.com/blebox/blebox_uniapi/pull/173
|
|
15
|
+
|
|
4
16
|
2.3.0 (2024-03-13)
|
|
5
17
|
------------------
|
|
6
18
|
* feat: add new methods to cover feature enabling handling of tilt open/close actions by @swistakm in https://github.com/blebox/blebox_uniapi/pull/154
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: blebox_uniapi
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Python API for accessing BleBox smart home devices
|
|
5
5
|
Home-page: https://github.com/blebox/blebox_uniapi
|
|
6
6
|
Author: BleBox
|
|
@@ -17,6 +17,7 @@ Requires-Python: >=3.9
|
|
|
17
17
|
Description-Content-Type: text/x-rst
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: aiohttp>=3
|
|
20
|
+
Requires-Dist: jmespath>1.0.0
|
|
20
21
|
|
|
21
22
|
====================
|
|
22
23
|
BleBox Python UniAPI
|
|
@@ -68,6 +69,18 @@ Credits
|
|
|
68
69
|
=======
|
|
69
70
|
History
|
|
70
71
|
=======
|
|
72
|
+
2.4.1 (2024-06-04)
|
|
73
|
+
------------------
|
|
74
|
+
* fix: rectify ambiguity around powerConsumption and wind sensor types
|
|
75
|
+
|
|
76
|
+
2.4.0 (2024-06-03)
|
|
77
|
+
------------------
|
|
78
|
+
* Fix: Refactor sensor_factory by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/163
|
|
79
|
+
* Order in BOX_TYPES by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/164
|
|
80
|
+
* Feature: smart meter by @swistakm in https://github.com/blebox/blebox_uniapi/pull/168
|
|
81
|
+
* Smartmeter by @pvsti in https://github.com/blebox/blebox_uniapi/pull/170
|
|
82
|
+
* fix: resolve regressions in cover and climate due to jmespath introduction by @swistakm in https://github.com/blebox/blebox_uniapi/pull/173
|
|
83
|
+
|
|
71
84
|
2.3.0 (2024-03-13)
|
|
72
85
|
------------------
|
|
73
86
|
* feat: add new methods to cover feature enabling handling of tilt open/close actions by @swistakm in https://github.com/blebox/blebox_uniapi/pull/154
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import re
|
|
4
3
|
import asyncio
|
|
5
4
|
import time
|
|
6
5
|
|
|
7
6
|
from typing import Optional, Any, Dict
|
|
8
7
|
|
|
9
|
-
from .box_types import
|
|
8
|
+
from .box_types import _DEFAULT_API_LEVEL, get_conf, get_conf_set
|
|
10
9
|
from .button import Button
|
|
11
10
|
from .climate import Climate
|
|
12
11
|
from .cover import Cover
|
|
@@ -19,7 +18,6 @@ from .switch import Switch
|
|
|
19
18
|
from .error import (
|
|
20
19
|
UnsupportedBoxResponse,
|
|
21
20
|
UnsupportedBoxVersion,
|
|
22
|
-
JPathFailed,
|
|
23
21
|
BadFieldExceedsMax,
|
|
24
22
|
BadFieldLessThanMin,
|
|
25
23
|
BadFieldMissing,
|
|
@@ -107,7 +105,7 @@ class Box:
|
|
|
107
105
|
info, f"{location} has no hardware version"
|
|
108
106
|
) from ex
|
|
109
107
|
|
|
110
|
-
level = int(info.get("apiLevel",
|
|
108
|
+
level = int(info.get("apiLevel", _DEFAULT_API_LEVEL))
|
|
111
109
|
|
|
112
110
|
self._data_path = config["api_path"]
|
|
113
111
|
self._type = type
|
|
@@ -179,7 +177,7 @@ class Box:
|
|
|
179
177
|
product = device_type
|
|
180
178
|
if device_type == "wLightBox" and product == "wLightBoxS":
|
|
181
179
|
device_type = "wLightBoxS"
|
|
182
|
-
level = int(info.get("apiLevel",
|
|
180
|
+
level = int(info.get("apiLevel", _DEFAULT_API_LEVEL))
|
|
183
181
|
config_set = get_conf_set(device_type)
|
|
184
182
|
if not config_set:
|
|
185
183
|
raise UnsupportedBoxResponse(f"{device_type} is not a supported type")
|
|
@@ -282,89 +280,6 @@ class Box:
|
|
|
282
280
|
self._last_real_update = None # force update
|
|
283
281
|
return await self._async_api(False, method, *args)
|
|
284
282
|
|
|
285
|
-
def follow(self, data: dict, path: str) -> Any:
|
|
286
|
-
"""
|
|
287
|
-
Return payload from device response json.
|
|
288
|
-
:param self:
|
|
289
|
-
:param data:
|
|
290
|
-
:param path:
|
|
291
|
-
:return:
|
|
292
|
-
"""
|
|
293
|
-
if data is None:
|
|
294
|
-
raise RuntimeError(f"bad argument: data {data}") # pragma: no cover
|
|
295
|
-
|
|
296
|
-
results = path.split("/")
|
|
297
|
-
current_tree = data
|
|
298
|
-
|
|
299
|
-
for chunk in results:
|
|
300
|
-
with_string_value = re.compile(r"^\[(.*)='(.*)']$")
|
|
301
|
-
match = with_string_value.match(chunk)
|
|
302
|
-
if match:
|
|
303
|
-
name = match.group(1)
|
|
304
|
-
value = match.group(2)
|
|
305
|
-
|
|
306
|
-
found = False
|
|
307
|
-
|
|
308
|
-
for item in current_tree:
|
|
309
|
-
if item[name] == value:
|
|
310
|
-
current_tree = item
|
|
311
|
-
found = True
|
|
312
|
-
break
|
|
313
|
-
|
|
314
|
-
if not found:
|
|
315
|
-
raise JPathFailed(f"with: {name}={value}", path, data)
|
|
316
|
-
|
|
317
|
-
continue # pragma: no cover
|
|
318
|
-
|
|
319
|
-
with_int_value = re.compile(r"^\[(.*)=(\d+)]$")
|
|
320
|
-
match = with_int_value.match(chunk)
|
|
321
|
-
if match:
|
|
322
|
-
name = match.group(1)
|
|
323
|
-
value = int(match.group(2))
|
|
324
|
-
|
|
325
|
-
found = False
|
|
326
|
-
|
|
327
|
-
if not isinstance(current_tree, list):
|
|
328
|
-
raise JPathFailed(
|
|
329
|
-
f"list expected but got {current_tree}", path, data
|
|
330
|
-
)
|
|
331
|
-
|
|
332
|
-
for item in current_tree:
|
|
333
|
-
if item[name] == value:
|
|
334
|
-
current_tree = item
|
|
335
|
-
found = True
|
|
336
|
-
break
|
|
337
|
-
|
|
338
|
-
if not found:
|
|
339
|
-
raise JPathFailed(f"with: {name}={value}", path, data)
|
|
340
|
-
continue # pragma: no cover
|
|
341
|
-
|
|
342
|
-
with_index = re.compile(r"^\[(\d+)]$")
|
|
343
|
-
match = with_index.match(chunk)
|
|
344
|
-
if match:
|
|
345
|
-
index = int(match.group(1))
|
|
346
|
-
if not isinstance(current_tree, list) or index >= len(current_tree):
|
|
347
|
-
raise JPathFailed(f"with value at index {index}", path, data)
|
|
348
|
-
|
|
349
|
-
current_tree = current_tree[index]
|
|
350
|
-
continue
|
|
351
|
-
|
|
352
|
-
if isinstance(current_tree, dict):
|
|
353
|
-
names = current_tree.keys()
|
|
354
|
-
if chunk not in names:
|
|
355
|
-
raise JPathFailed(
|
|
356
|
-
f"item '{chunk}' not among {list(names)}", path, data
|
|
357
|
-
)
|
|
358
|
-
|
|
359
|
-
current_tree = current_tree[chunk]
|
|
360
|
-
else:
|
|
361
|
-
raise JPathFailed(
|
|
362
|
-
f"unexpected item type: '{chunk}' not in: {current_tree}",
|
|
363
|
-
path,
|
|
364
|
-
data,
|
|
365
|
-
)
|
|
366
|
-
return current_tree
|
|
367
|
-
|
|
368
283
|
def expect_int(
|
|
369
284
|
self, field: str, raw_value: int, maximum: int = -1, minimum: int = 0
|
|
370
285
|
) -> int:
|