blebox-uniapi 2.5.4__tar.gz → 2.5.5__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 (39) hide show
  1. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/PKG-INFO +1 -1
  2. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/__init__.py +1 -1
  3. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/box_types.py +34 -0
  4. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/cover.py +36 -8
  5. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/sensor.py +4 -0
  6. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/PKG-INFO +1 -1
  7. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/setup.cfg +1 -1
  8. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/setup.py +1 -1
  9. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/CONTRIBUTING.rst +0 -0
  10. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/HISTORY.rst +0 -0
  11. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/LICENSE +0 -0
  12. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/MANIFEST.in +0 -0
  13. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/README.rst +0 -0
  14. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/binary_sensor.py +0 -0
  15. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/box.py +0 -0
  16. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/button.py +0 -0
  17. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/climate.py +0 -0
  18. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/error.py +0 -0
  19. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/feature.py +0 -0
  20. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/jfollow.py +0 -0
  21. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/light.py +0 -0
  22. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/session.py +0 -0
  23. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/switch.py +0 -0
  24. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi/update.py +0 -0
  25. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/SOURCES.txt +0 -0
  26. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/dependency_links.txt +0 -0
  27. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/not-zip-safe +0 -0
  28. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/requires.txt +0 -0
  29. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/blebox_uniapi.egg-info/top_level.txt +0 -0
  30. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/Makefile +0 -0
  31. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/authors.rst +0 -0
  32. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/conf.py +0 -0
  33. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/contributing.rst +0 -0
  34. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/history.rst +0 -0
  35. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/index.rst +0 -0
  36. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/installation.rst +0 -0
  37. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/make.bat +0 -0
  38. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/readme.rst +0 -0
  39. {blebox_uniapi-2.5.4 → blebox_uniapi-2.5.5}/docs/usage.rst +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blebox_uniapi
3
- Version: 2.5.4
3
+ Version: 2.5.5
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
@@ -2,4 +2,4 @@
2
2
 
3
3
  __author__ = """BleBox"""
4
4
  __email__ = "opensource@blebox.eu"
5
- __version__ = "2.5.4"
5
+ __version__ = "2.5.5"
@@ -380,6 +380,36 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
380
380
  ]
381
381
  ],
382
382
  },
383
+ 20220505: {
384
+ "api_path": "/state/extended",
385
+ "extended_state_path": "/state/extended",
386
+ "api": {
387
+ # note: old control api (i.e. /s/0, /s/1, /s/2) still supported but
388
+ # now deprecated. switchBox has now API consistent with switchBoxD
389
+ "on": lambda x=None: ("GET", f"/s/{x}/1", None),
390
+ "off": lambda x=None: ("GET", f"/s/{x}/0", None),
391
+ },
392
+ "switches": [
393
+ [
394
+ "relay",
395
+ {"state": lambda x: f"relays[?relay==`{x}`]|[0]|state"},
396
+ "relay",
397
+ ]
398
+ ],
399
+ "sensors": [
400
+ [
401
+ "switchBox.energy",
402
+ {
403
+ # note: switchbox/switchboxD sensors are currently not indexed (singletons)
404
+ "powerConsumption": lambda x: "powerMeasuring.powerConsumption[0]|value ",
405
+ "activePower": lambda x: "sensors[?type == 'activePower']|[0]|value",
406
+ "voltage": lambda x: "sensors[?type == 'voltage']|[0]|value",
407
+ "periodS": "powerMeasuring.powerConsumption[0]|periodS",
408
+ "measurement_enabled": "powerMeasuring.enabled",
409
+ },
410
+ ]
411
+ ],
412
+ },
383
413
  },
384
414
  # switchBoxD
385
415
  "switchBoxD": {
@@ -724,11 +754,15 @@ BOX_TYPE_CONF: dict[str, dict[int, dict[str, Any]]] = {
724
754
  "reactivePower": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reactivePower']|[0]|value",
725
755
  "reverseActiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseActiveEnergy']|[0]|value",
726
756
  "forwardActiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardActiveEnergy']|[0]|value",
757
+ "forwardReactiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'forwardReactiveEnergy']|[0]|value",
758
+ "reverseReactiveEnergy": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'reverseReactiveEnergy']|[0]|value",
727
759
  "illuminance": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'illuminance']|[0]|value",
728
760
  "temperature": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'temperature']|[0]|value",
729
761
  "wind": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'wind']|[0]|value",
730
762
  "humidity": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'humidity']|[0]|value",
731
763
  "openStatus": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'openStatus']|[0]|value",
764
+ "co2": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2']|[0]|value",
765
+ "co2Definition": lambda x: f"multiSensor.sensors[?id == `{x}`]|[?type == 'co2Definition']|[0]|value",
732
766
  },
733
767
  ]
734
768
  ],
@@ -101,7 +101,7 @@ class UnifiedCoverType(IntEnum):
101
101
  class Gate:
102
102
  _control_type: Optional[int]
103
103
 
104
- def __init__(self, control_type: int):
104
+ def __init__(self, control_type: int, is_calibrated: bool = False):
105
105
  self._control_type = control_type
106
106
 
107
107
  def read_state(self, alias: str, raw_value: Any, product: "Box") -> int:
@@ -148,6 +148,10 @@ class Gate:
148
148
  def close_command(self) -> str:
149
149
  return "close"
150
150
 
151
+ @property
152
+ def is_calibrated(self) -> None:
153
+ return None
154
+
151
155
  def stop_command(self, has_stop: bool) -> str:
152
156
  return "stop"
153
157
 
@@ -157,6 +161,11 @@ class Gate:
157
161
 
158
162
  class Shutter(Gate):
159
163
  _control_type: Optional[ShutterBoxControlType]
164
+ _is_calibrated: bool
165
+
166
+ def __init__(self, control_type: int, is_calibrated: bool = False):
167
+ super().__init__(control_type)
168
+ self._is_calibrated = is_calibrated
160
169
 
161
170
  @property
162
171
  def min_position(self) -> int:
@@ -185,14 +194,22 @@ class Shutter(Gate):
185
194
 
186
195
  @property
187
196
  def is_slider(self) -> bool:
188
- return self._control_type not in (
189
- ShutterBoxControlType.NO_CALIBRATION,
190
- ShutterBoxControlType.CURTAIN,
191
- ShutterBoxControlType.TILT_ONLY,
192
- ShutterBoxControlType.PERGOLA_ROOF_TILT_ONLY,
193
- ShutterBoxControlType.TILT_SHUTTER_WITHOUT_POSITIONING,
197
+ return (
198
+ self._control_type
199
+ not in (
200
+ ShutterBoxControlType.NO_CALIBRATION,
201
+ ShutterBoxControlType.CURTAIN,
202
+ ShutterBoxControlType.TILT_ONLY,
203
+ ShutterBoxControlType.PERGOLA_ROOF_TILT_ONLY,
204
+ ShutterBoxControlType.TILT_SHUTTER_WITHOUT_POSITIONING,
205
+ )
206
+ and self.is_calibrated is True
194
207
  )
195
208
 
209
+ @property
210
+ def is_calibrated(self) -> bool:
211
+ return self._is_calibrated
212
+
196
213
  def read_cover_type(
197
214
  self, alias: str, raw_value: Any, product: "Box"
198
215
  ) -> UnifiedCoverType:
@@ -355,13 +372,20 @@ class Cover(Feature):
355
372
  extended_state: dict,
356
373
  ) -> None:
357
374
  control_type = None
375
+ is_calibrated: bool = False
358
376
  if extended_state and issubclass(subclass, Shutter):
359
377
  control_type = extended_state.get("shutter", {}).get("controlType", None)
378
+ is_calibrated = bool(
379
+ extended_state.get("shutter", {})
380
+ .get("calibrationParameters", {})
381
+ .get("isCalibrated", False)
382
+ )
383
+
360
384
  elif extended_state and issubclass(subclass, GateBoxB):
361
385
  control_type = extended_state.get("gate", {}).get("openCloseMode", None)
362
386
 
363
387
  self._device_class = dev_class
364
- self._attributes: GateT = subclass(control_type)
388
+ self._attributes: GateT = subclass(control_type, is_calibrated)
365
389
  self._tilt_current = None
366
390
  super().__init__(product, alias, methods)
367
391
 
@@ -383,6 +407,10 @@ class Cover(Feature):
383
407
  def tilt_current(self):
384
408
  return self._tilt_current
385
409
 
410
+ @property
411
+ def is_calibrated(self) -> Optional[bool]:
412
+ return self._attributes.is_calibrated
413
+
386
414
  @property
387
415
  def is_slider(self) -> Any:
388
416
  return self._attributes.is_slider
@@ -160,12 +160,16 @@ class BaseSensor(Feature):
160
160
  @SensorFactory.register("apparentPower", unit="va")
161
161
  @SensorFactory.register("reactivePower", unit="var")
162
162
  @SensorFactory.register("activePower", unit="W")
163
+ @SensorFactory.register("reverseReactiveEnergy", unit="kvarh", scale=1_000)
164
+ @SensorFactory.register("forwardReactiveEnergy", unit="kvarh", scale=1_000)
163
165
  @SensorFactory.register("reverseActiveEnergy", unit="kWh", scale=1_000)
164
166
  @SensorFactory.register("forwardActiveEnergy", unit="kWh", scale=1_000)
165
167
  @SensorFactory.register("illuminance", unit="lx", scale=100)
166
168
  @SensorFactory.register("humidity", unit="percentage", scale=100)
167
169
  @SensorFactory.register("wind", unit="m/s", scale=10)
168
170
  @SensorFactory.register("openStatus", unit="")
171
+ @SensorFactory.register("co2", unit="ppm")
172
+ @SensorFactory.register("co2Definition", unit="")
169
173
  class GenericSensor(BaseSensor):
170
174
  def __init__(
171
175
  # base sensor params
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: blebox-uniapi
3
- Version: 2.5.4
3
+ Version: 2.5.5
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
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 2.5.4
2
+ current_version = 2.5.5
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.5.4",
26
+ version="2.5.5",
27
27
  author="BleBox",
28
28
  author_email="opensource@blebox.eu",
29
29
  python_requires=">=3.9",
File without changes
File without changes
File without changes
File without changes