PySwitchbot 0.68.2__tar.gz → 0.68.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.
Files changed (93) hide show
  1. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PKG-INFO +1 -1
  2. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PySwitchbot.egg-info/PKG-INFO +1 -1
  3. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/setup.py +1 -1
  4. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parser.py +2 -1
  5. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/relay_switch.py +17 -0
  6. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/evaporative_humidifier.py +4 -1
  7. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_adv_parser.py +8 -0
  8. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_evaporative_humidifier.py +1 -0
  9. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/LICENSE +0 -0
  10. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/MANIFEST.in +0 -0
  11. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PySwitchbot.egg-info/SOURCES.txt +0 -0
  12. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PySwitchbot.egg-info/dependency_links.txt +0 -0
  13. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PySwitchbot.egg-info/requires.txt +0 -0
  14. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/PySwitchbot.egg-info/top_level.txt +0 -0
  15. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/README.md +0 -0
  16. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/pyproject.toml +0 -0
  17. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/setup.cfg +0 -0
  18. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/__init__.py +0 -0
  19. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/__init__.py +0 -0
  20. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/air_purifier.py +0 -0
  21. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/blind_tilt.py +0 -0
  22. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/bot.py +0 -0
  23. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/bulb.py +0 -0
  24. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/ceiling_light.py +0 -0
  25. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/contact.py +0 -0
  26. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/curtain.py +0 -0
  27. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/fan.py +0 -0
  28. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/hub2.py +0 -0
  29. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/hub3.py +0 -0
  30. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/hubmini_matter.py +0 -0
  31. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/humidifier.py +0 -0
  32. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/keypad.py +0 -0
  33. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/leak.py +0 -0
  34. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/light_strip.py +0 -0
  35. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/lock.py +0 -0
  36. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/meter.py +0 -0
  37. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/motion.py +0 -0
  38. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/plug.py +0 -0
  39. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/remote.py +0 -0
  40. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/roller_shade.py +0 -0
  41. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/adv_parsers/vacuum.py +0 -0
  42. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/api_config.py +0 -0
  43. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/__init__.py +0 -0
  44. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/air_purifier.py +0 -0
  45. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/evaporative_humidifier.py +0 -0
  46. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/fan.py +0 -0
  47. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/hub2.py +0 -0
  48. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/hub3.py +0 -0
  49. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/light.py +0 -0
  50. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/const/lock.py +0 -0
  51. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/__init__.py +0 -0
  52. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/air_purifier.py +0 -0
  53. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/base_cover.py +0 -0
  54. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/base_light.py +0 -0
  55. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/blind_tilt.py +0 -0
  56. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/bot.py +0 -0
  57. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/bulb.py +0 -0
  58. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/ceiling_light.py +0 -0
  59. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/contact.py +0 -0
  60. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/curtain.py +0 -0
  61. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/device.py +0 -0
  62. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/fan.py +0 -0
  63. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/humidifier.py +0 -0
  64. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/keypad.py +0 -0
  65. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/light_strip.py +0 -0
  66. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/lock.py +0 -0
  67. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/meter.py +0 -0
  68. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/motion.py +0 -0
  69. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/plug.py +0 -0
  70. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/relay_switch.py +0 -0
  71. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/roller_shade.py +0 -0
  72. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/devices/vacuum.py +0 -0
  73. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/discovery.py +0 -0
  74. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/enum.py +0 -0
  75. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/helpers.py +0 -0
  76. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/switchbot/models.py +0 -0
  77. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_air_purifier.py +0 -0
  78. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_base_cover.py +0 -0
  79. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_blind_tilt.py +0 -0
  80. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_bulb.py +0 -0
  81. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_ceiling_light.py +0 -0
  82. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_colormode_imports.py +0 -0
  83. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_curtain.py +0 -0
  84. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_encrypted_device.py +0 -0
  85. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_fan.py +0 -0
  86. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_helpers.py +0 -0
  87. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_hub2.py +0 -0
  88. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_hub3.py +0 -0
  89. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_lock.py +0 -0
  90. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_relay_switch.py +0 -0
  91. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_roller_shade.py +0 -0
  92. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_strip_light.py +0 -0
  93. {pyswitchbot-0.68.2 → pyswitchbot-0.68.4}/tests/test_vacuum.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySwitchbot
3
- Version: 0.68.2
3
+ Version: 0.68.4
4
4
  Summary: A library to communicate with Switchbot
5
5
  Home-page: https://github.com/sblibs/pySwitchbot/
6
6
  Author: Daniel Hjelseth Hoyer
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySwitchbot
3
- Version: 0.68.2
3
+ Version: 0.68.4
4
4
  Summary: A library to communicate with Switchbot
5
5
  Home-page: https://github.com/sblibs/pySwitchbot/
6
6
  Author: Daniel Hjelseth Hoyer
@@ -20,7 +20,7 @@ setup(
20
20
  "cryptography>=39.0.0",
21
21
  "pyOpenSSL>=23.0.0",
22
22
  ],
23
- version="0.68.2",
23
+ version="0.68.4",
24
24
  description="A library to communicate with Switchbot",
25
25
  long_description=long_description,
26
26
  long_description_content_type="text/markdown",
@@ -36,6 +36,7 @@ from .adv_parsers.motion import process_wopresence
36
36
  from .adv_parsers.plug import process_woplugmini
37
37
  from .adv_parsers.relay_switch import (
38
38
  process_garage_door_opener,
39
+ process_relay_switch_1pm,
39
40
  process_relay_switch_2pm,
40
41
  process_relay_switch_common_data,
41
42
  )
@@ -213,7 +214,7 @@ SUPPORTED_TYPES: dict[str | bytes, SwitchbotSupportedType] = {
213
214
  "<": {
214
215
  "modelName": SwitchbotModel.RELAY_SWITCH_1PM,
215
216
  "modelFriendlyName": "Relay Switch 1PM",
216
- "func": process_relay_switch_common_data,
217
+ "func": process_relay_switch_1pm,
217
218
  "manufacturer_id": 2409,
218
219
  },
219
220
  ";": {
@@ -4,6 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  from typing import Any
6
6
 
7
+ from ..helpers import parse_power_data
8
+
7
9
 
8
10
  def process_relay_switch_common_data(
9
11
  data: bytes | None, mfr_data: bytes | None
@@ -18,6 +20,18 @@ def process_relay_switch_common_data(
18
20
  }
19
21
 
20
22
 
23
+ def process_relay_switch_1pm(
24
+ data: bytes | None, mfr_data: bytes | None
25
+ ) -> dict[str, Any]:
26
+ """Process Relay Switch 1PM services data."""
27
+ if mfr_data is None:
28
+ return {}
29
+
30
+ common_data = process_relay_switch_common_data(data, mfr_data)
31
+ common_data["power"] = parse_power_data(mfr_data, 10)
32
+ return common_data
33
+
34
+
21
35
  def process_garage_door_opener(
22
36
  data: bytes | None, mfr_data: bytes | None
23
37
  ) -> dict[str, Any]:
@@ -39,10 +53,13 @@ def process_relay_switch_2pm(
39
53
  return {
40
54
  1: {
41
55
  **process_relay_switch_common_data(data, mfr_data),
56
+ "power": parse_power_data(mfr_data, 10),
42
57
  },
43
58
  2: {
44
59
  "switchMode": True, # for compatibility, useless
45
60
  "sequence_number": mfr_data[6],
46
61
  "isOn": bool(mfr_data[7] & 0b01000000),
62
+ "power": parse_power_data(mfr_data, 12),
47
63
  },
64
+ "sequence_number": mfr_data[6],
48
65
  }
@@ -149,8 +149,11 @@ class SwitchbotEvaporativeHumidifier(SwitchbotSequenceDevice, SwitchbotEncrypted
149
149
  result = await self._send_command(command)
150
150
  return self._check_command_result(result, 0, {1})
151
151
 
152
- def _validate_water_level(self) -> None:
152
+ def _validate_water_level(self, mode: HumidifierMode | None = None) -> None:
153
153
  """Validate that the water level is not empty."""
154
+ if mode == HumidifierMode.DRYING_FILTER:
155
+ return
156
+
154
157
  if self.get_water_level() == HumidifierWaterLevel.EMPTY.name.lower():
155
158
  raise SwitchbotOperationError(
156
159
  "Cannot perform operation when water tank is empty"
@@ -3236,12 +3236,15 @@ def test_humidifer_with_empty_data() -> None:
3236
3236
  "isOn": True,
3237
3237
  "sequence_number": 138,
3238
3238
  "switchMode": True,
3239
+ "power": 0.0,
3239
3240
  },
3240
3241
  2: {
3241
3242
  "isOn": True,
3242
3243
  "sequence_number": 138,
3243
3244
  "switchMode": True,
3245
+ "power": 70.0,
3244
3246
  },
3247
+ "sequence_number": 138,
3245
3248
  },
3246
3249
  "=",
3247
3250
  "Relay Switch 2PM",
@@ -3266,6 +3269,7 @@ def test_humidifer_with_empty_data() -> None:
3266
3269
  "isOn": True,
3267
3270
  "sequence_number": 71,
3268
3271
  "switchMode": True,
3272
+ "power": 49.0,
3269
3273
  },
3270
3274
  "<",
3271
3275
  "Relay Switch 1PM",
@@ -3400,12 +3404,15 @@ def test_adv_active(test_case: AdvTestCase) -> None:
3400
3404
  "isOn": True,
3401
3405
  "sequence_number": 138,
3402
3406
  "switchMode": True,
3407
+ "power": 0.0,
3403
3408
  },
3404
3409
  2: {
3405
3410
  "isOn": True,
3406
3411
  "sequence_number": 138,
3407
3412
  "switchMode": True,
3413
+ "power": 70.0,
3408
3414
  },
3415
+ "sequence_number": 138,
3409
3416
  },
3410
3417
  "=",
3411
3418
  "Relay Switch 2PM",
@@ -3430,6 +3437,7 @@ def test_adv_active(test_case: AdvTestCase) -> None:
3430
3437
  "isOn": True,
3431
3438
  "sequence_number": 71,
3432
3439
  "switchMode": True,
3440
+ "power": 49.0,
3433
3441
  },
3434
3442
  "<",
3435
3443
  "Relay Switch 1PM",
@@ -250,6 +250,7 @@ async def test_set_target_humidity():
250
250
  async def test_set_mode(mode, command):
251
251
  """Test setting mode."""
252
252
  device = create_device_for_command_testing()
253
+ device._validate_water_level(mode)
253
254
  device.get_target_humidity = MagicMock(return_value=45)
254
255
 
255
256
  await device.set_mode(mode)
File without changes
File without changes
File without changes
File without changes