blebox-uniapi 2.3.0__tar.gz → 2.4.0__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.
Files changed (53) hide show
  1. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/HISTORY.rst +8 -0
  2. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/PKG-INFO +10 -1
  3. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/__init__.py +1 -1
  4. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/box.py +3 -88
  5. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/box_types.py +162 -105
  6. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/climate.py +4 -6
  7. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/cover.py +7 -5
  8. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/error.py +1 -38
  9. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/feature.py +2 -1
  10. blebox_uniapi-2.4.0/blebox_uniapi/jfollow.py +11 -0
  11. blebox_uniapi-2.4.0/blebox_uniapi/sensor.py +252 -0
  12. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/session.py +2 -2
  13. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi.egg-info/PKG-INFO +10 -1
  14. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi.egg-info/SOURCES.txt +1 -1
  15. blebox_uniapi-2.4.0/blebox_uniapi.egg-info/requires.txt +2 -0
  16. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/setup.cfg +1 -1
  17. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/setup.py +2 -2
  18. blebox_uniapi-2.4.0/tests/test_box.py +169 -0
  19. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_box_types.py +11 -0
  20. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_switch.py +144 -160
  21. blebox_uniapi-2.3.0/blebox_uniapi/sensor.py +0 -231
  22. blebox_uniapi-2.3.0/blebox_uniapi.egg-info/requires.txt +0 -1
  23. blebox_uniapi-2.3.0/tests/test_box.py +0 -210
  24. blebox_uniapi-2.3.0/tests/test_error.py +0 -48
  25. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/CONTRIBUTING.rst +0 -0
  26. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/LICENSE +0 -0
  27. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/MANIFEST.in +0 -0
  28. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/README.rst +0 -0
  29. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/binary_sensor.py +0 -0
  30. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/button.py +0 -0
  31. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/light.py +0 -0
  32. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi/switch.py +0 -0
  33. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi.egg-info/dependency_links.txt +0 -0
  34. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi.egg-info/not-zip-safe +0 -0
  35. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/blebox_uniapi.egg-info/top_level.txt +0 -0
  36. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/Makefile +0 -0
  37. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/authors.rst +0 -0
  38. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/conf.py +0 -0
  39. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/contributing.rst +0 -0
  40. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/history.rst +0 -0
  41. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/index.rst +0 -0
  42. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/installation.rst +0 -0
  43. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/make.bat +0 -0
  44. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/readme.rst +0 -0
  45. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/docs/usage.rst +0 -0
  46. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_button.py +0 -0
  47. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_climate.py +0 -0
  48. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_cover.py +0 -0
  49. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_light.py +0 -0
  50. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_light_unit.py +0 -0
  51. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_sensor.py +0 -0
  52. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_session.py +0 -0
  53. {blebox_uniapi-2.3.0 → blebox_uniapi-2.4.0}/tests/test_unknown.py +0 -0
@@ -1,6 +1,14 @@
1
1
  =======
2
2
  History
3
3
  =======
4
+ 2.4.0 (2024-06-03)
5
+ ------------------
6
+ * Fix: Refactor sensor_factory by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/163
7
+ * Order in BOX_TYPES by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/164
8
+ * Feature: smart meter by @swistakm in https://github.com/blebox/blebox_uniapi/pull/168
9
+ * Smartmeter by @pvsti in https://github.com/blebox/blebox_uniapi/pull/170
10
+ * fix: resolve regressions in cover and climate due to jmespath introduction by @swistakm in https://github.com/blebox/blebox_uniapi/pull/173
11
+
4
12
  2.3.0 (2024-03-13)
5
13
  ------------------
6
14
  * 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.0
3
+ Version: 2.4.0
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,14 @@ Credits
68
69
  =======
69
70
  History
70
71
  =======
72
+ 2.4.0 (2024-06-03)
73
+ ------------------
74
+ * Fix: Refactor sensor_factory by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/163
75
+ * Order in BOX_TYPES by @Pastucha in https://github.com/blebox/blebox_uniapi/pull/164
76
+ * Feature: smart meter by @swistakm in https://github.com/blebox/blebox_uniapi/pull/168
77
+ * Smartmeter by @pvsti in https://github.com/blebox/blebox_uniapi/pull/170
78
+ * fix: resolve regressions in cover and climate due to jmespath introduction by @swistakm in https://github.com/blebox/blebox_uniapi/pull/173
79
+
71
80
  2.3.0 (2024-03-13)
72
81
  ------------------
73
82
  * 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
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = """BleBox"""
4
4
  __email__ = "opensource@blebox.eu"
5
- __version__ = "2.3.0"
5
+ __version__ = "2.4.0"
@@ -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 default_api_level, get_conf, get_conf_set
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", default_api_level))
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", default_api_level))
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: