switchbot-api 2.7.0__tar.gz → 2.9.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.7.0 → switchbot_api-2.9.0}/PKG-INFO +4 -2
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/pyproject.toml +1 -1
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/switchbot_api/__init__.py +7 -0
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/switchbot_api/commands.py +62 -16
- switchbot_api-2.9.0/switchbot_api/models.py +93 -0
- switchbot_api-2.7.0/switchbot_api/models.py +0 -47
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/LICENSE +0 -0
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/README.md +0 -0
- {switchbot_api-2.7.0 → switchbot_api-2.9.0}/switchbot_api/exceptions.py +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: switchbot_api
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
4
4
|
Summary: An asynchronous library to use Switchbot API
|
|
5
5
|
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
6
7
|
Author: Ravaka Razafimanantsoa
|
|
7
8
|
Author-email: contact@ravaka.dev
|
|
8
9
|
Requires-Python: >=3.10,<4.0
|
|
@@ -12,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
12
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
17
|
Requires-Dist: aiohttp (>=3.0.0)
|
|
16
18
|
Project-URL: Repository, https://github.com/SeraphicCorp/py-switchbot-api
|
|
17
19
|
Description-Content-Type: text/markdown
|
|
@@ -37,6 +37,7 @@ from switchbot_api.commands import (
|
|
|
37
37
|
RGBWLightCommands,
|
|
38
38
|
RGBWWLightCommands,
|
|
39
39
|
RollerShadeCommands,
|
|
40
|
+
SmartRadiatorThermostatCommands,
|
|
40
41
|
SpeakerCommands,
|
|
41
42
|
Switch2PMCommands,
|
|
42
43
|
SwitchCommands,
|
|
@@ -54,6 +55,7 @@ from switchbot_api.exceptions import (
|
|
|
54
55
|
from switchbot_api.models import (
|
|
55
56
|
BatteryCirculatorFanMode,
|
|
56
57
|
PowerState,
|
|
58
|
+
SmartRadiatorThermostatMode,
|
|
57
59
|
VacuumCleanMode,
|
|
58
60
|
VacuumFanSpeed,
|
|
59
61
|
VacuumFanSpeedV2,
|
|
@@ -71,6 +73,7 @@ __all__ = [
|
|
|
71
73
|
"CommonCommands",
|
|
72
74
|
"CurtainCommands",
|
|
73
75
|
"DVDCommands",
|
|
76
|
+
"Device",
|
|
74
77
|
"DoorBellCommands",
|
|
75
78
|
"FanCommands",
|
|
76
79
|
"HumidifierCommands",
|
|
@@ -82,9 +85,13 @@ __all__ = [
|
|
|
82
85
|
"PowerState",
|
|
83
86
|
"RGBWLightCommands",
|
|
84
87
|
"RGBWWLightCommands",
|
|
88
|
+
"Remote",
|
|
85
89
|
"RollerShadeCommands",
|
|
90
|
+
"SmartRadiatorThermostatCommands",
|
|
91
|
+
"SmartRadiatorThermostatMode",
|
|
86
92
|
"SpeakerCommands",
|
|
87
93
|
"Switch2PMCommands",
|
|
94
|
+
"SwitchBotAPI",
|
|
88
95
|
"SwitchCommands",
|
|
89
96
|
"T",
|
|
90
97
|
"TVCommands",
|
|
@@ -190,13 +190,15 @@ class RGBWLightCommands(Commands):
|
|
|
190
190
|
|
|
191
191
|
# Supported Device list:
|
|
192
192
|
# Strip Light
|
|
193
|
+
# RGBIC Neon Rope Light
|
|
194
|
+
# RGBIC Neon Wire Rope Light
|
|
193
195
|
SET_BRIGHTNESS = "setBrightness"
|
|
194
196
|
SET_COLOR = "setColor"
|
|
195
197
|
|
|
196
198
|
@classmethod
|
|
197
199
|
def get_supported_devices(cls) -> list[str]:
|
|
198
200
|
"""Get supported devices."""
|
|
199
|
-
return ["Strip Light"]
|
|
201
|
+
return ["Strip Light", "RGBIC Neon Rope Light", "RGBIC Neon Wire Rope Light"]
|
|
200
202
|
|
|
201
203
|
|
|
202
204
|
class RGBWWLightCommands(Commands):
|
|
@@ -206,6 +208,8 @@ class RGBWWLightCommands(Commands):
|
|
|
206
208
|
# Floor Lamp
|
|
207
209
|
# Strip Light 3
|
|
208
210
|
# Color Bulb
|
|
211
|
+
# RGBICWW Floor Lamp
|
|
212
|
+
# RGBICWW Strip Light
|
|
209
213
|
SET_BRIGHTNESS = "setBrightness"
|
|
210
214
|
SET_COLOR = "setColor"
|
|
211
215
|
SET_COLOR_TEMPERATURE = "setColorTemperature"
|
|
@@ -213,7 +217,39 @@ class RGBWWLightCommands(Commands):
|
|
|
213
217
|
@classmethod
|
|
214
218
|
def get_supported_devices(cls) -> list[str]:
|
|
215
219
|
"""Get supported devices."""
|
|
216
|
-
return [
|
|
220
|
+
return [
|
|
221
|
+
"Strip Light 3",
|
|
222
|
+
"Floor Lamp",
|
|
223
|
+
"Color Bulb",
|
|
224
|
+
"RGBICWW Floor Lamp",
|
|
225
|
+
"RGBICWW Strip Light",
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class CeilingLightCommands(Commands):
|
|
230
|
+
"""Ceiling light commands."""
|
|
231
|
+
|
|
232
|
+
# 1-100
|
|
233
|
+
SET_BRIGHTNESS = "setBrightness"
|
|
234
|
+
# 2700-6500
|
|
235
|
+
SET_COLOR_TEMPERATURE = "setColorTemperature"
|
|
236
|
+
|
|
237
|
+
@classmethod
|
|
238
|
+
def get_supported_devices(cls) -> list[str]:
|
|
239
|
+
"""Get supported devices."""
|
|
240
|
+
return ["Ceiling Light", "Ceiling Light Pro"]
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class ArtFrameCommands(Commands):
|
|
244
|
+
"""AI Art Frame commands."""
|
|
245
|
+
|
|
246
|
+
PREVIOUS = "previous"
|
|
247
|
+
NEXT = "next"
|
|
248
|
+
|
|
249
|
+
@classmethod
|
|
250
|
+
def get_supported_devices(cls) -> list[str]:
|
|
251
|
+
"""Get supported devices."""
|
|
252
|
+
return ["AI Art Frame"]
|
|
217
253
|
|
|
218
254
|
|
|
219
255
|
class DoorBellCommands(Commands):
|
|
@@ -285,20 +321,6 @@ class VacuumCleanerV3Commands(Commands):
|
|
|
285
321
|
return ["Robot Vacuum Cleaner S10", "S20"]
|
|
286
322
|
|
|
287
323
|
|
|
288
|
-
class CeilingLightCommands(Commands):
|
|
289
|
-
"""Ceiling light commands."""
|
|
290
|
-
|
|
291
|
-
# 1-100
|
|
292
|
-
SET_BRIGHTNESS = "setBrightness"
|
|
293
|
-
# 2700-6500
|
|
294
|
-
SET_COLOR_TEMPERATURE = "setColorTemperature"
|
|
295
|
-
|
|
296
|
-
@classmethod
|
|
297
|
-
def get_supported_devices(cls) -> list[str]:
|
|
298
|
-
"""Get supported devices."""
|
|
299
|
-
return ["Ceiling Light", "Ceiling Light Pro"]
|
|
300
|
-
|
|
301
|
-
|
|
302
324
|
class BlindTiltCommands(Commands):
|
|
303
325
|
"""Blind Tilt commands."""
|
|
304
326
|
|
|
@@ -384,4 +406,28 @@ class LightCommands(Commands):
|
|
|
384
406
|
BRIGHTNESS_DOWN = "brightnessDown"
|
|
385
407
|
|
|
386
408
|
|
|
409
|
+
class SmartRadiatorThermostatCommands(Commands):
|
|
410
|
+
"""Smart Radiator Thermostat commands."""
|
|
411
|
+
|
|
412
|
+
SET_MODE = "setMode"
|
|
413
|
+
SET_MANUAL_MODE_TEMPERATURE = "setManualModeTemperature"
|
|
414
|
+
|
|
415
|
+
@classmethod
|
|
416
|
+
def get_supported_devices(cls) -> list[str]:
|
|
417
|
+
"""Get supported devices."""
|
|
418
|
+
return ["Smart Radiator Thermostat"]
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
class KeyPadCommands(Commands):
|
|
422
|
+
"""Keypad commands."""
|
|
423
|
+
|
|
424
|
+
DELETE_KEY = "deleteKey"
|
|
425
|
+
CREATE_KEY = "createKey"
|
|
426
|
+
|
|
427
|
+
@classmethod
|
|
428
|
+
def get_supported_devices(cls) -> list[str]:
|
|
429
|
+
"""Get supported devices."""
|
|
430
|
+
return ["Keypad", "Keypad Touch", "Keypad Vision", "Keypad Vision pro"]
|
|
431
|
+
|
|
432
|
+
|
|
387
433
|
T = TypeVar("T", bound=CommonCommands)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""constant for SwitchBot API."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from enum import Enum, StrEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class PowerState(Enum):
|
|
9
|
+
"""Power state."""
|
|
10
|
+
|
|
11
|
+
ON = "on"
|
|
12
|
+
OFF = "off"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BatteryCirculatorFanMode(StrEnum):
|
|
16
|
+
"""Fan mode types [Battery Circulator Fan] API."""
|
|
17
|
+
|
|
18
|
+
DIRECT = "direct"
|
|
19
|
+
NATURAL = "natural"
|
|
20
|
+
SLEEP = "sleep"
|
|
21
|
+
BABY = "baby"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class VacuumFanSpeed(StrEnum):
|
|
25
|
+
"""Fan options for VacuumCommands supported devices."""
|
|
26
|
+
|
|
27
|
+
VACUUM_FAN_SPEED_QUIET = "0"
|
|
28
|
+
VACUUM_FAN_SPEED_STANDARD = "1"
|
|
29
|
+
VACUUM_FAN_SPEED_STRONG = "2"
|
|
30
|
+
VACUUM_FAN_SPEED_MAX = "3"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class VacuumFanSpeedV2(StrEnum):
|
|
34
|
+
"""Fan options for VacuumV2Commands & VacuumV3Commands supported devices."""
|
|
35
|
+
|
|
36
|
+
VACUUM_FAN_SPEED_QUIET = "1"
|
|
37
|
+
VACUUM_FAN_SPEED_STANDARD = "2"
|
|
38
|
+
VACUUM_FAN_SPEED_STRONG = "3"
|
|
39
|
+
VACUUM_FAN_SPEED_MAX = "4"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class VacuumCleanMode(StrEnum):
|
|
43
|
+
"""Clean mode for Vacuum."""
|
|
44
|
+
|
|
45
|
+
SWEEP = "sweep"
|
|
46
|
+
MOP = "mop"
|
|
47
|
+
SWEEP_MOP = "sweep_mop"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class SmartRadiatorThermostatMode(Enum):
|
|
51
|
+
"""mode for Smart Radiator Thermostat ."""
|
|
52
|
+
|
|
53
|
+
SCHEDULE = 0
|
|
54
|
+
MANUAL = 1
|
|
55
|
+
OFF = 2
|
|
56
|
+
ENERGY_SAVING = 3
|
|
57
|
+
COMFORT = 4
|
|
58
|
+
FAST_HEATING = 5
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def get_all_modes(cls) -> list[SmartRadiatorThermostatMode]:
|
|
62
|
+
"""Get all modes as a list."""
|
|
63
|
+
return [
|
|
64
|
+
cls.SCHEDULE,
|
|
65
|
+
cls.MANUAL,
|
|
66
|
+
cls.OFF,
|
|
67
|
+
cls.ENERGY_SAVING,
|
|
68
|
+
cls.COMFORT,
|
|
69
|
+
cls.FAST_HEATING,
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class BatteryLevel(Enum):
|
|
74
|
+
"""Battery Level modes."""
|
|
75
|
+
|
|
76
|
+
High = "high"
|
|
77
|
+
Medium = "medium"
|
|
78
|
+
Low = "low"
|
|
79
|
+
Critical = "critical"
|
|
80
|
+
Unknown = "unknown"
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def get_battery_level(cls, value: int) -> BatteryLevel:
|
|
84
|
+
"""Return a battery level."""
|
|
85
|
+
if 100 >= value >= 60:
|
|
86
|
+
return cls.High
|
|
87
|
+
if 60 > value >= 20:
|
|
88
|
+
return cls.Medium
|
|
89
|
+
if 20 > value >= 10:
|
|
90
|
+
return cls.Low
|
|
91
|
+
if 10 > value >= 0:
|
|
92
|
+
return cls.Critical
|
|
93
|
+
return cls.Unknown
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"""constant for SwitchBot API."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
|
|
5
|
-
from enum import Enum, StrEnum
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class PowerState(Enum):
|
|
9
|
-
"""Power state."""
|
|
10
|
-
|
|
11
|
-
ON = "on"
|
|
12
|
-
OFF = "off"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class BatteryCirculatorFanMode(StrEnum):
|
|
16
|
-
"""Fan mode types [Battery Circulator Fan] API."""
|
|
17
|
-
|
|
18
|
-
DIRECT = "direct"
|
|
19
|
-
NATURAL = "natural"
|
|
20
|
-
SLEEP = "sleep"
|
|
21
|
-
BABY = "baby"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class VacuumFanSpeed(StrEnum):
|
|
25
|
-
"""Fan options for VacuumCommands supported devices."""
|
|
26
|
-
|
|
27
|
-
VACUUM_FAN_SPEED_QUIET = "0"
|
|
28
|
-
VACUUM_FAN_SPEED_STANDARD = "1"
|
|
29
|
-
VACUUM_FAN_SPEED_STRONG = "2"
|
|
30
|
-
VACUUM_FAN_SPEED_MAX = "3"
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
class VacuumFanSpeedV2(StrEnum):
|
|
34
|
-
"""Fan options for VacuumV2Commands & VacuumV3Commands supported devices."""
|
|
35
|
-
|
|
36
|
-
VACUUM_FAN_SPEED_QUIET = "1"
|
|
37
|
-
VACUUM_FAN_SPEED_STANDARD = "2"
|
|
38
|
-
VACUUM_FAN_SPEED_STRONG = "3"
|
|
39
|
-
VACUUM_FAN_SPEED_MAX = "4"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class VacuumCleanMode(StrEnum):
|
|
43
|
-
"""Clean mode for Vacuum."""
|
|
44
|
-
|
|
45
|
-
SWEEP = "sweep"
|
|
46
|
-
MOP = "mop"
|
|
47
|
-
SWEEP_MOP = "sweep_mop"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|