switchbot-api 2.13.0__tar.gz → 2.14.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.
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/PKG-INFO +2 -1
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/pyproject.toml +1 -1
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/switchbot_api/__init__.py +12 -2
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/switchbot_api/commands.py +49 -0
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/switchbot_api/models.py +39 -0
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/LICENSE +0 -0
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/README.md +0 -0
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/switchbot_api/exceptions.py +0 -0
- {switchbot_api-2.13.0 → switchbot_api-2.14.0}/switchbot_api/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: switchbot_api
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.14.0
|
|
4
4
|
Summary: An asynchronous library to use Switchbot API
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
18
|
Requires-Dist: aiohttp (>=3.0.0)
|
|
18
19
|
Requires-Dist: pycryptodome (>=3.23.0,<4.0.0)
|
|
19
20
|
Project-URL: Repository, https://github.com/SeraphicCorp/py-switchbot-api
|
|
@@ -39,9 +39,11 @@ from switchbot_api.commands import (
|
|
|
39
39
|
LockCommands,
|
|
40
40
|
LockV2Commands,
|
|
41
41
|
LockV3Commands,
|
|
42
|
+
ModernCeilingFanCommands,
|
|
42
43
|
OthersCommands,
|
|
43
44
|
RGBICWWCeilingLightCommands,
|
|
44
45
|
RGBWLightCommands,
|
|
46
|
+
RGBWWLightBarsCommands,
|
|
45
47
|
RGBWWLightCommands,
|
|
46
48
|
RollerShadeCommands,
|
|
47
49
|
SmartRadiatorThermostatCommands,
|
|
@@ -73,6 +75,8 @@ from switchbot_api.models import (
|
|
|
73
75
|
KataFriendsMode,
|
|
74
76
|
KataFriendsWorkStatus,
|
|
75
77
|
PowerState,
|
|
78
|
+
RGBICWWLightBarsControlMode,
|
|
79
|
+
RGBICWWLightBarsMusicMode,
|
|
76
80
|
SmartRadiatorThermostatMode,
|
|
77
81
|
Switch,
|
|
78
82
|
SwitchbotCloudDeviceLockState,
|
|
@@ -114,10 +118,14 @@ __all__ = [
|
|
|
114
118
|
"LockCommands",
|
|
115
119
|
"LockV2Commands",
|
|
116
120
|
"LockV3Commands",
|
|
121
|
+
"ModernCeilingFanCommands",
|
|
117
122
|
"OthersCommands",
|
|
118
123
|
"PowerState",
|
|
119
124
|
"RGBICWWCeilingLightCommands",
|
|
125
|
+
"RGBICWWLightBarsControlMode",
|
|
126
|
+
"RGBICWWLightBarsMusicMode",
|
|
120
127
|
"RGBWLightCommands",
|
|
128
|
+
"RGBWWLightBarsCommands",
|
|
121
129
|
"RGBWWLightCommands",
|
|
122
130
|
"Remote",
|
|
123
131
|
"RollerShadeCommands",
|
|
@@ -239,9 +247,11 @@ class SwitchBotAPI:
|
|
|
239
247
|
except (
|
|
240
248
|
ClientError,
|
|
241
249
|
ClientResponseError,
|
|
242
|
-
socket.gaierror,
|
|
243
250
|
) as exception:
|
|
244
|
-
msg = "Error occurred while communicating
|
|
251
|
+
msg = f"Error occurred while communicating, Status Code: {exception}"
|
|
252
|
+
raise SwitchBotConnectionError(msg) from exception
|
|
253
|
+
except socket.gaierror as exception:
|
|
254
|
+
msg = "DNS resolution failed."
|
|
245
255
|
raise SwitchBotConnectionError(msg) from exception
|
|
246
256
|
if response.status == 403:
|
|
247
257
|
raise SwitchBotAuthenticationError
|
|
@@ -245,6 +245,53 @@ class RGBWWLightCommands(Commands):
|
|
|
245
245
|
]
|
|
246
246
|
|
|
247
247
|
|
|
248
|
+
class RGBWWLightBarsCommands(Commands):
|
|
249
|
+
"""RGBWW Light Bars commands."""
|
|
250
|
+
|
|
251
|
+
SET_BRIGHTNESS = "setBrightness"
|
|
252
|
+
SET_COLOR = "setColor"
|
|
253
|
+
SET_COLOR_TEMPERATURE = "setColorTemperature"
|
|
254
|
+
SET_BRIGHTNESS_AND_TEMPERATURE = "setBrightnessAndTemperature"
|
|
255
|
+
SET_MUSIC_COLOR_MODE = "setMusicColorMode"
|
|
256
|
+
SET_MUSIC_PARAM_MODE = "setMusicParamMode"
|
|
257
|
+
SET_EFFECT_COLOR_MODE = "setEffectColorMode"
|
|
258
|
+
SET_EFFECT_SPEED_MODE = "setEffectSpeedMode"
|
|
259
|
+
SET_SEGMENT_COLOR_MODE = "setSegmentColorMode"
|
|
260
|
+
SET_LIGHT_EFFECT = "setLightEffect"
|
|
261
|
+
|
|
262
|
+
@classmethod
|
|
263
|
+
def get_supported_devices(cls) -> list[str]:
|
|
264
|
+
"""Get supported devices."""
|
|
265
|
+
return [
|
|
266
|
+
"RGBICWW Light Bars",
|
|
267
|
+
]
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
class ModernCeilingFanCommands(Commands):
|
|
271
|
+
"""Modern Ceiling Fan commands."""
|
|
272
|
+
|
|
273
|
+
TURN_ON_FAN = "turnOnFan"
|
|
274
|
+
TURN_OFF_FAN = "turnOffFan"
|
|
275
|
+
SET_WIND_MODE = "setWindMode"
|
|
276
|
+
SET_WIND_SPEED = "setWindSpeed"
|
|
277
|
+
CLOSE_DELAY = "closeDelay"
|
|
278
|
+
TURN_ON_MAIN_LIGHT = "turnOnMainLight"
|
|
279
|
+
TURN_OFF_MAIN_LIGHT = "turnOffMainLight"
|
|
280
|
+
SET_MAIN_BRIGHTNESS = "setMainBrightness"
|
|
281
|
+
TURN_ON_BACK_LIGHT = "turnOnBackLight"
|
|
282
|
+
TURN_OFF_BACK_LIGHT = "turnOffBackLight"
|
|
283
|
+
SET_BACK_BRIGHTNESS = "setBackBrightness"
|
|
284
|
+
SET_COLOR_TEMPERATURE = "setColorTemperature"
|
|
285
|
+
SET_COLOR = "setColor"
|
|
286
|
+
|
|
287
|
+
@classmethod
|
|
288
|
+
def get_supported_devices(cls) -> list[str]:
|
|
289
|
+
"""Get supported devices."""
|
|
290
|
+
return [
|
|
291
|
+
"Modern Ceiling Fan",
|
|
292
|
+
]
|
|
293
|
+
|
|
294
|
+
|
|
248
295
|
class CeilingLightCommands(Commands):
|
|
249
296
|
"""Ceiling light commands."""
|
|
250
297
|
|
|
@@ -280,6 +327,8 @@ class RGBICWWCeilingLightCommands(Commands):
|
|
|
280
327
|
# R:G:B
|
|
281
328
|
SET_COLOR_LIGHT_RGB = "setColorLightRGB"
|
|
282
329
|
|
|
330
|
+
SET_LIGHT_EFFECT = "setLightEffect"
|
|
331
|
+
|
|
283
332
|
@classmethod
|
|
284
333
|
def get_supported_devices(cls) -> list[str]:
|
|
285
334
|
"""Get supported devices."""
|
|
@@ -207,3 +207,42 @@ class SwitchbotCloudDeviceLockState(Enum):
|
|
|
207
207
|
def get_values(cls) -> list[str]:
|
|
208
208
|
"""Get lock value."""
|
|
209
209
|
return [mode.value for mode in cls]
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
class RGBICWWLightBarsMusicMode(Enum):
|
|
213
|
+
"""RGBICWW Light Bars Music Mode."""
|
|
214
|
+
|
|
215
|
+
DYNAMIC = 0
|
|
216
|
+
WAVE = 1
|
|
217
|
+
BLOOM = 2
|
|
218
|
+
CRASH = 3
|
|
219
|
+
FLOW = 4
|
|
220
|
+
ENERGY = 5
|
|
221
|
+
|
|
222
|
+
@classmethod
|
|
223
|
+
def get_states(cls) -> list[RGBICWWLightBarsMusicMode]:
|
|
224
|
+
"""Get states."""
|
|
225
|
+
return list(cls)
|
|
226
|
+
|
|
227
|
+
@classmethod
|
|
228
|
+
def get_values(cls) -> list[int]:
|
|
229
|
+
"""Get value."""
|
|
230
|
+
return [mode.value for mode in cls]
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class RGBICWWLightBarsControlMode(Enum):
|
|
234
|
+
"""RGBICWW Light Bars ControlMode."""
|
|
235
|
+
|
|
236
|
+
CONTROLLER = 0
|
|
237
|
+
PHONE = 1
|
|
238
|
+
VOLUME = 2
|
|
239
|
+
|
|
240
|
+
@classmethod
|
|
241
|
+
def get_states(cls) -> list[RGBICWWLightBarsControlMode]:
|
|
242
|
+
"""Get states."""
|
|
243
|
+
return list(cls)
|
|
244
|
+
|
|
245
|
+
@classmethod
|
|
246
|
+
def get_values(cls) -> list[int]:
|
|
247
|
+
"""Get value."""
|
|
248
|
+
return [mode.value for mode in cls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|