PySwitchbot 3.1.0__py3-none-any.whl → 3.2.0__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySwitchbot
3
- Version: 3.1.0
3
+ Version: 3.2.0
4
4
  Summary: A library to communicate with Switchbot
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,5 +1,5 @@
1
1
  switchbot/__init__.py,sha256=pltMTceeYF7-Y9-3kGrnoTFXTIVHKoSWGgW-5JL3uwU,4673
2
- switchbot/__version__.py,sha256=YVoF76lT0p3dIsqphNnDWuqSia3gZP1S1eQYXZ9FbSE,22
2
+ switchbot/__version__.py,sha256=OUX37Yd6ZO82d0GJL2dmK0gZTtc_xvlTvGQIl2I-D8k,22
3
3
  switchbot/adv_parser.py,sha256=M0Wy6rAlv0gipNFuV6FKW4IwQ0ea_wcPPhDN3Py5s9M,35473
4
4
  switchbot/adv_parsers/__init__.py,sha256=d39GEAICA1RrQiLy1ks49x0d9a-A_yKn9Awkj5za8Uk,46
5
5
  switchbot/adv_parsers/_sensor_th.py,sha256=FjVvxtkH6nZ-3u2W4q6zvDE1H4849JZ5LXRNd_nedhU,1182
@@ -49,7 +49,7 @@ switchbot/devices/art_frame.py,sha256=doMr_hGWWE9eqSXzxLGYJaBy_6AkBjGfhvB3vb5ZN3
49
49
  switchbot/devices/base_cover.py,sha256=UWNA7eGbJdY80Mu-k41xO4tnyk7FhpYaWRWihGvDM2g,4385
50
50
  switchbot/devices/base_light.py,sha256=WWJJdRHfvoSYMRHDSv_RCmo5D6hYoZRxQVYfsOXZ7K0,6590
51
51
  switchbot/devices/blind_tilt.py,sha256=tY0JoZhyqU_6PlhjtnIaEeIG3Z-JdZKJ5Jwg_5b6xSQ,5761
52
- switchbot/devices/bot.py,sha256=Co2IiQa2si0WPs3HFize2CPpj5GVbMT570vMP5YWpaQ,4121
52
+ switchbot/devices/bot.py,sha256=yM2woM_HVxI9_Cf8qFSYztGRIKdHKjJzs6QDBQ9KHFE,4828
53
53
  switchbot/devices/bulb.py,sha256=ISxXck8JsBlFojLB8M5Wfip_z4o6_-VvyFbBvqK6_Bg,2313
54
54
  switchbot/devices/ceiling_light.py,sha256=7gxgsZz5ku6Bx8jfHSBkPcydjgagwGEuPvl5N-cMO6M,4600
55
55
  switchbot/devices/contact.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
@@ -77,7 +77,7 @@ switchbot/helpers.py,sha256=DJLvYZ4Dq0dkiGMOzfR--nSTM_8jE9QtB7t570PuGSU,2091
77
77
  switchbot/models.py,sha256=xibQOVGHC60FWWc54N6BW46vxFuJUjj6tK1Qw0_eTbI,372
78
78
  switchbot/oauth.py,sha256=j8tsfcy4d5qPqsnqrzaQ_Nro3ltyO0rCRgVTFXMFTKc,6487
79
79
  switchbot/utils.py,sha256=x1Qm0uIA1Jvxg4uxcQDBgWnopoU04-swKtjjCJ1Khak,1224
80
- pyswitchbot-3.1.0.dist-info/METADATA,sha256=S1RcyATxPZwXMscGrg4rJ_sDYV4TdaPYkQiwdTcmd84,8374
81
- pyswitchbot-3.1.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
82
- pyswitchbot-3.1.0.dist-info/licenses/LICENSE,sha256=_hdUCmoRDzki4fYDJfn-5KpG7-7p6YJ6IsbMfrTXN6Y,1078
83
- pyswitchbot-3.1.0.dist-info/RECORD,,
80
+ pyswitchbot-3.2.0.dist-info/METADATA,sha256=bBquIslC7-75BXR8OSEiYq9Yig8eg_H4eMK_nv8I-8M,8374
81
+ pyswitchbot-3.2.0.dist-info/WHEEL,sha256=L-WvLdSBvJWHXv5zrQxDvNRnIgoBzLUpcbuiw19KCuQ,88
82
+ pyswitchbot-3.2.0.dist-info/licenses/LICENSE,sha256=_hdUCmoRDzki4fYDJfn-5KpG7-7p6YJ6IsbMfrTXN6Y,1078
83
+ pyswitchbot-3.2.0.dist-info/RECORD,,
switchbot/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "3.1.0"
1
+ __version__ = "3.2.0"
switchbot/devices/bot.py CHANGED
@@ -9,6 +9,7 @@ from .device import (
9
9
  DEVICE_SET_EXTENDED_KEY,
10
10
  DEVICE_SET_MODE_KEY,
11
11
  SwitchbotDeviceOverrideStateDuringConnection,
12
+ SwitchbotOperationError,
12
13
  update_after_operation,
13
14
  )
14
15
 
@@ -90,6 +91,18 @@ class Switchbot(SwitchbotDeviceOverrideStateDuringConnection):
90
91
  result = await self._send_command(DEVICE_SET_MODE_KEY + strength_key + mode_key)
91
92
  return self._check_command_result(result, 0, {1})
92
93
 
94
+ async def set_inverse_direction(self, inverse: bool) -> bool:
95
+ """Set the Bot's inverse direction while preserving its other mode settings."""
96
+ if not (settings := await self.get_basic_info()):
97
+ raise SwitchbotOperationError(
98
+ f"{self.name}: Unable to get current Bot mode settings"
99
+ )
100
+ return await self.set_switch_mode(
101
+ switch_mode=settings["switchMode"],
102
+ strength=settings["strength"],
103
+ inverse=inverse,
104
+ )
105
+
93
106
  @update_after_operation
94
107
  async def set_long_press(self, duration: int = 0) -> bool:
95
108
  """Set bot long press duration."""
@@ -121,3 +134,7 @@ class Switchbot(SwitchbotDeviceOverrideStateDuringConnection):
121
134
  if self._inverse:
122
135
  return not value
123
136
  return value
137
+
138
+ def inverse_direction(self) -> bool | None:
139
+ """Return the cached inverse direction setting."""
140
+ return self._get_adv_value("inverseDirection")