blebox-uniapi 2.4.1__tar.gz → 2.5.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 (49) hide show
  1. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/HISTORY.rst +8 -0
  2. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/PKG-INFO +9 -13
  3. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/README.rst +0 -12
  4. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/__init__.py +1 -1
  5. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/box_types.py +14 -0
  6. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/feature.py +4 -0
  7. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/sensor.py +41 -8
  8. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/PKG-INFO +9 -13
  9. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/setup.cfg +1 -1
  10. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/setup.py +1 -1
  11. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/CONTRIBUTING.rst +0 -0
  12. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/LICENSE +0 -0
  13. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/MANIFEST.in +0 -0
  14. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/binary_sensor.py +0 -0
  15. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/box.py +0 -0
  16. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/button.py +0 -0
  17. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/climate.py +0 -0
  18. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/cover.py +0 -0
  19. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/error.py +0 -0
  20. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/jfollow.py +0 -0
  21. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/light.py +0 -0
  22. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/session.py +0 -0
  23. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi/switch.py +0 -0
  24. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/SOURCES.txt +0 -0
  25. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/dependency_links.txt +0 -0
  26. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/not-zip-safe +0 -0
  27. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/requires.txt +0 -0
  28. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/blebox_uniapi.egg-info/top_level.txt +0 -0
  29. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/Makefile +0 -0
  30. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/authors.rst +0 -0
  31. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/conf.py +0 -0
  32. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/contributing.rst +0 -0
  33. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/history.rst +0 -0
  34. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/index.rst +0 -0
  35. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/installation.rst +0 -0
  36. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/make.bat +0 -0
  37. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/readme.rst +0 -0
  38. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/docs/usage.rst +0 -0
  39. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_box.py +0 -0
  40. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_box_types.py +0 -0
  41. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_button.py +0 -0
  42. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_climate.py +0 -0
  43. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_cover.py +0 -0
  44. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_light.py +0 -0
  45. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_light_unit.py +0 -0
  46. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_sensor.py +0 -0
  47. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_session.py +0 -0
  48. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_switch.py +0 -0
  49. {blebox_uniapi-2.4.1 → blebox_uniapi-2.5.0}/tests/test_unknown.py +0 -0
@@ -1,6 +1,14 @@
1
1
  =======
2
2
  History
3
3
  =======
4
+ 2.5.0 (2024-08-20)
5
+ ------------------
6
+ * feature: expose sensor_id in sensors and alias in all features by @swistakm in https://github.com/blebox/blebox_uniapi/pull/176
7
+
8
+ 2.4.2 (2024-06-04)
9
+ ------------------
10
+ * fix: add missing support for active power sensors on switchbox/switchboxd devices by @swistakm in https://github.com/blebox/blebox_uniapi/pull/175
11
+
4
12
  2.4.1 (2024-06-04)
5
13
  ------------------
6
14
  * fix: rectify ambiguity around powerConsumption and wind sensor types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blebox_uniapi
3
- Version: 2.4.1
3
+ Version: 2.5.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
@@ -23,20 +23,9 @@ Requires-Dist: jmespath>1.0.0
23
23
  BleBox Python UniAPI
24
24
  ====================
25
25
 
26
-
27
26
  .. image:: https://img.shields.io/pypi/v/blebox_uniapi.svg
28
27
  :target: https://pypi.python.org/pypi/blebox_uniapi
29
28
 
30
- .. image:: https://travis-ci.com/blebox/blebox_uniapi.svg?branch=master
31
- :target: https://travis-ci.com/blebox/blebox_uniapi
32
-
33
- .. image:: https://readthedocs.org/projects/blebox-uniapi/badge/?version=latest
34
- :target: https://blebox-uniapi.readthedocs.io/en/latest/?badge=latest
35
- :alt: Documentation Status
36
-
37
-
38
-
39
-
40
29
  Python API for accessing BleBox smart home devices
41
30
 
42
31
 
@@ -60,7 +49,6 @@ Contributions are welcome!
60
49
  Credits
61
50
  -------
62
51
 
63
-
64
52
  .. _Cookiecutter: https://github.com/audreyr/cookiecutter
65
53
  .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
66
54
  .. _`11 BleBox smart home devices`: https://blebox.eu/produkty/?lang=en
@@ -69,6 +57,14 @@ Credits
69
57
  =======
70
58
  History
71
59
  =======
60
+ 2.5.0 (2024-08-20)
61
+ ------------------
62
+ * feature: expose sensor_id in sensors and alias in all features by @swistakm in https://github.com/blebox/blebox_uniapi/pull/176
63
+
64
+ 2.4.2 (2024-06-04)
65
+ ------------------
66
+ * fix: add missing support for active power sensors on switchbox/switchboxd devices by @swistakm in https://github.com/blebox/blebox_uniapi/pull/175
67
+
72
68
  2.4.1 (2024-06-04)
73
69
  ------------------
74
70
  * fix: rectify ambiguity around powerConsumption and wind sensor types
@@ -2,20 +2,9 @@
2
2
  BleBox Python UniAPI
3
3
  ====================
4
4
 
5
-
6
5
  .. image:: https://img.shields.io/pypi/v/blebox_uniapi.svg
7
6
  :target: https://pypi.python.org/pypi/blebox_uniapi
8
7
 
9
- .. image:: https://travis-ci.com/blebox/blebox_uniapi.svg?branch=master
10
- :target: https://travis-ci.com/blebox/blebox_uniapi
11
-
12
- .. image:: https://readthedocs.org/projects/blebox-uniapi/badge/?version=latest
13
- :target: https://blebox-uniapi.readthedocs.io/en/latest/?badge=latest
14
- :alt: Documentation Status
15
-
16
-
17
-
18
-
19
8
  Python API for accessing BleBox smart home devices
20
9
 
21
10
 
@@ -39,7 +28,6 @@ Contributions are welcome!
39
28
  Credits
40
29
  -------
41
30
 
42
-
43
31
  .. _Cookiecutter: https://github.com/audreyr/cookiecutter
44
32
  .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
45
33
  .. _`11 BleBox smart home devices`: https://blebox.eu/produkty/?lang=en
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = """BleBox"""
4
4
  __email__ = "opensource@blebox.eu"
5
- __version__ = "2.4.1"
5
+ __version__ = "2.5.0"
@@ -280,7 +280,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
280
280
  [
281
281
  "switchBox.energy",
282
282
  {
283
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
283
284
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value",
285
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
284
286
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
285
287
  "measurement_enabled": "powerMeasuring.enabled",
286
288
  },
@@ -305,7 +307,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
305
307
  [
306
308
  "switchBox.energy",
307
309
  {
310
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
308
311
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value",
312
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
309
313
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
310
314
  "measurement_enabled": "powerMeasuring.enabled",
311
315
  },
@@ -330,7 +334,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
330
334
  [
331
335
  "switchBox.energy",
332
336
  {
337
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
333
338
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value",
339
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
334
340
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
335
341
  "measurement_enabled": "powerMeasuring.enabled",
336
342
  },
@@ -357,7 +363,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
357
363
  [
358
364
  "switchBox.energy",
359
365
  {
366
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
360
367
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ",
368
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
361
369
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
362
370
  "measurement_enabled": "powerMeasuring.enabled",
363
371
  },
@@ -392,7 +400,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
392
400
  [
393
401
  "switchBox.energy",
394
402
  {
403
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
395
404
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ",
405
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
396
406
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
397
407
  "measurement_enabled": "powerMeasuring.enabled",
398
408
  },
@@ -424,7 +434,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
424
434
  [
425
435
  "switchBox.energy",
426
436
  {
437
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
427
438
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ",
439
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
428
440
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
429
441
  "measurement_enabled": "powerMeasuring.enabled",
430
442
  },
@@ -456,7 +468,9 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
456
468
  [
457
469
  "switchBox.energy",
458
470
  {
471
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
459
472
  "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ",
473
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
460
474
  "periodS": "powerMeasuring.powerConsumption[0]|periodS",
461
475
  "measurement_enabled": "powerMeasuring.enabled",
462
476
  },
@@ -42,6 +42,10 @@ class Feature:
42
42
  def product(self) -> "Box":
43
43
  return self._product
44
44
 
45
+ @property
46
+ def alias(self):
47
+ return self._alias
48
+
45
49
  # TODO: (cleanup) move to product/box ?
46
50
  def raw_value(self, name: str) -> Any:
47
51
  product = self._product
@@ -35,7 +35,9 @@ class SensorFactory:
35
35
  # note: probably we should iterate extended state in future if there
36
36
  # are other api flavours other than multiSensor that provide sensors
37
37
  states = extended_state.get("multiSensor", {}).get("sensors", [])
38
-
38
+ # note: but for now we are only able to support non-multisensor devices
39
+ # that provide sensor data in extended data payload root
40
+ states.extend(extended_state.get("sensors", []))
39
41
  # note: power measuring feature predates multiSensor API, so we need a small
40
42
  # shim to adapt older shape of power measuring schema to the new sensor API
41
43
  if "powerMeasuring" in extended_state:
@@ -71,7 +73,10 @@ class SensorFactory:
71
73
  }
72
74
 
73
75
  feature = constructor(
74
- product=product, alias=alias, methods=materialized_methods
76
+ product=product,
77
+ alias=alias,
78
+ methods=materialized_methods,
79
+ sensor_id=sensor_id,
75
80
  )
76
81
  object_list.append(feature)
77
82
 
@@ -96,11 +101,18 @@ class BaseSensor(Feature):
96
101
  _device_class: str
97
102
  _native_value: Union[float, int, str]
98
103
  _sensor_type: Optional[str]
104
+ _sensor_id: Optional[int]
99
105
 
100
106
  def __init__(
101
- self, product: "Box", alias: str, methods: dict, sensor_type: str = None
107
+ self,
108
+ product: "Box",
109
+ alias: str,
110
+ methods: dict,
111
+ sensor_type: str = None,
112
+ sensor_id: Optional[int] = None,
102
113
  ):
103
114
  self._sensor_type = sensor_type
115
+ self._sensor_id = sensor_id
104
116
  super().__init__(product, alias, methods)
105
117
 
106
118
  @property
@@ -115,6 +127,14 @@ class BaseSensor(Feature):
115
127
  def native_value(self):
116
128
  return self._native_value
117
129
 
130
+ @property
131
+ def sensor_id(self):
132
+ return self._sensor_id
133
+
134
+ @property
135
+ def probe_id(self):
136
+ return self.sensor_id
137
+
118
138
  @classmethod
119
139
  def many_from_config(cls, product, box_type_config, extended_state):
120
140
  raise NotImplementedError("Please use SensorFactory")
@@ -141,6 +161,7 @@ class GenericSensor(BaseSensor):
141
161
  product: "Box",
142
162
  alias: str,
143
163
  methods: dict,
164
+ sensor_id: Optional[int],
144
165
  *,
145
166
  # generalization params
146
167
  sensor_type: str,
@@ -148,7 +169,7 @@ class GenericSensor(BaseSensor):
148
169
  scale: float = 1,
149
170
  precision: Optional[int] = None,
150
171
  ):
151
- super().__init__(product, alias, methods)
172
+ super().__init__(product, alias, methods, sensor_id=sensor_id)
152
173
  self._unit = unit
153
174
  self._scale = scale
154
175
  self._precision = precision
@@ -198,8 +219,14 @@ class PowerConsumption(GenericSensor):
198
219
  class Temperature(BaseSensor):
199
220
  _current: Union[float, int, None]
200
221
 
201
- def __init__(self, product: "Box", alias: str, methods: dict):
202
- super().__init__(product, alias, methods)
222
+ def __init__(
223
+ self,
224
+ product: "Box",
225
+ alias: str,
226
+ methods: dict,
227
+ sensor_id: Optional[int] = None,
228
+ ):
229
+ super().__init__(product, alias, methods, sensor_id=sensor_id)
203
230
  self._unit = "celsius"
204
231
  self._device_class = "temperature"
205
232
 
@@ -225,8 +252,14 @@ class Temperature(BaseSensor):
225
252
  class AirQuality(BaseSensor):
226
253
  _pm: Optional[int]
227
254
 
228
- def __init__(self, product: "Box", alias: str, methods: dict):
229
- super().__init__(product, alias, methods)
255
+ def __init__(
256
+ self,
257
+ product: "Box",
258
+ alias: str,
259
+ methods: dict,
260
+ sensor_id: Optional[str] = None,
261
+ ):
262
+ super().__init__(product, alias, methods, sensor_id)
230
263
  self._unit = "concentration_of_mp"
231
264
  self._device_class = alias
232
265
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blebox_uniapi
3
- Version: 2.4.1
3
+ Version: 2.5.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
@@ -23,20 +23,9 @@ Requires-Dist: jmespath>1.0.0
23
23
  BleBox Python UniAPI
24
24
  ====================
25
25
 
26
-
27
26
  .. image:: https://img.shields.io/pypi/v/blebox_uniapi.svg
28
27
  :target: https://pypi.python.org/pypi/blebox_uniapi
29
28
 
30
- .. image:: https://travis-ci.com/blebox/blebox_uniapi.svg?branch=master
31
- :target: https://travis-ci.com/blebox/blebox_uniapi
32
-
33
- .. image:: https://readthedocs.org/projects/blebox-uniapi/badge/?version=latest
34
- :target: https://blebox-uniapi.readthedocs.io/en/latest/?badge=latest
35
- :alt: Documentation Status
36
-
37
-
38
-
39
-
40
29
  Python API for accessing BleBox smart home devices
41
30
 
42
31
 
@@ -60,7 +49,6 @@ Contributions are welcome!
60
49
  Credits
61
50
  -------
62
51
 
63
-
64
52
  .. _Cookiecutter: https://github.com/audreyr/cookiecutter
65
53
  .. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage
66
54
  .. _`11 BleBox smart home devices`: https://blebox.eu/produkty/?lang=en
@@ -69,6 +57,14 @@ Credits
69
57
  =======
70
58
  History
71
59
  =======
60
+ 2.5.0 (2024-08-20)
61
+ ------------------
62
+ * feature: expose sensor_id in sensors and alias in all features by @swistakm in https://github.com/blebox/blebox_uniapi/pull/176
63
+
64
+ 2.4.2 (2024-06-04)
65
+ ------------------
66
+ * fix: add missing support for active power sensors on switchbox/switchboxd devices by @swistakm in https://github.com/blebox/blebox_uniapi/pull/175
67
+
72
68
  2.4.1 (2024-06-04)
73
69
  ------------------
74
70
  * fix: rectify ambiguity around powerConsumption and wind sensor types
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 2.4.1
2
+ current_version = 2.5.0
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -23,7 +23,7 @@ test_requirements = [
23
23
  ]
24
24
 
25
25
  setup(
26
- version="2.4.1",
26
+ version="2.5.0",
27
27
  author="BleBox",
28
28
  author_email="opensource@blebox.eu",
29
29
  python_requires=">=3.9",
File without changes
File without changes