switchbot-api 2.11.1__tar.gz → 2.13.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.11.1 → switchbot_api-2.13.0}/PKG-INFO +1 -1
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/pyproject.toml +1 -1
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/switchbot_api/__init__.py +27 -0
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/switchbot_api/commands.py +53 -4
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/switchbot_api/models.py +99 -0
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/LICENSE +0 -0
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/README.md +0 -0
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/switchbot_api/exceptions.py +0 -0
- {switchbot_api-2.11.1 → switchbot_api-2.13.0}/switchbot_api/utils.py +0 -0
|
@@ -33,12 +33,14 @@ from switchbot_api.commands import (
|
|
|
33
33
|
FanCommands,
|
|
34
34
|
HumidifierCommands,
|
|
35
35
|
HumidifierV2Commands,
|
|
36
|
+
KataFriendsCommands,
|
|
36
37
|
KeyPadCommands,
|
|
37
38
|
LightCommands,
|
|
38
39
|
LockCommands,
|
|
39
40
|
LockV2Commands,
|
|
40
41
|
LockV3Commands,
|
|
41
42
|
OthersCommands,
|
|
43
|
+
RGBICWWCeilingLightCommands,
|
|
42
44
|
RGBWLightCommands,
|
|
43
45
|
RGBWWLightCommands,
|
|
44
46
|
RollerShadeCommands,
|
|
@@ -56,14 +58,24 @@ from switchbot_api.exceptions import (
|
|
|
56
58
|
SwitchBotAuthenticationError,
|
|
57
59
|
SwitchBotConnectionError,
|
|
58
60
|
SwitchBotDeviceOfflineError,
|
|
61
|
+
SwitchBotDeviceRequestError,
|
|
62
|
+
SwitchBotError,
|
|
59
63
|
)
|
|
60
64
|
from switchbot_api.models import (
|
|
61
65
|
AirPurifierFanGear,
|
|
62
66
|
AirPurifierMode,
|
|
67
|
+
AirPurifierModeV2,
|
|
68
|
+
BatteryCirculatorFan2ProMode,
|
|
63
69
|
BatteryCirculatorFanMode,
|
|
64
70
|
BatteryLevel,
|
|
71
|
+
Humidifier2Mode,
|
|
72
|
+
KataFriendsHospitalizedStatus,
|
|
73
|
+
KataFriendsMode,
|
|
74
|
+
KataFriendsWorkStatus,
|
|
65
75
|
PowerState,
|
|
66
76
|
SmartRadiatorThermostatMode,
|
|
77
|
+
Switch,
|
|
78
|
+
SwitchbotCloudDeviceLockState,
|
|
67
79
|
VacuumCleanMode,
|
|
68
80
|
VacuumFanSpeed,
|
|
69
81
|
VacuumFanSpeedV2,
|
|
@@ -74,7 +86,9 @@ __all__ = [
|
|
|
74
86
|
"AirPurifierCommands",
|
|
75
87
|
"AirPurifierFanGear",
|
|
76
88
|
"AirPurifierMode",
|
|
89
|
+
"AirPurifierModeV2",
|
|
77
90
|
"ArtFrameCommands",
|
|
91
|
+
"BatteryCirculatorFan2ProMode",
|
|
78
92
|
"BatteryCirculatorFanCommands",
|
|
79
93
|
"BatteryCirculatorFanMode",
|
|
80
94
|
"BatteryLevel",
|
|
@@ -88,8 +102,13 @@ __all__ = [
|
|
|
88
102
|
"Device",
|
|
89
103
|
"DoorBellCommands",
|
|
90
104
|
"FanCommands",
|
|
105
|
+
"Humidifier2Mode",
|
|
91
106
|
"HumidifierCommands",
|
|
92
107
|
"HumidifierV2Commands",
|
|
108
|
+
"KataFriendsCommands",
|
|
109
|
+
"KataFriendsHospitalizedStatus",
|
|
110
|
+
"KataFriendsMode",
|
|
111
|
+
"KataFriendsWorkStatus",
|
|
93
112
|
"KeyPadCommands",
|
|
94
113
|
"LightCommands",
|
|
95
114
|
"LockCommands",
|
|
@@ -97,6 +116,7 @@ __all__ = [
|
|
|
97
116
|
"LockV3Commands",
|
|
98
117
|
"OthersCommands",
|
|
99
118
|
"PowerState",
|
|
119
|
+
"RGBICWWCeilingLightCommands",
|
|
100
120
|
"RGBWLightCommands",
|
|
101
121
|
"RGBWWLightCommands",
|
|
102
122
|
"Remote",
|
|
@@ -104,9 +124,16 @@ __all__ = [
|
|
|
104
124
|
"SmartRadiatorThermostatCommands",
|
|
105
125
|
"SmartRadiatorThermostatMode",
|
|
106
126
|
"SpeakerCommands",
|
|
127
|
+
"Switch",
|
|
107
128
|
"Switch2PMCommands",
|
|
108
129
|
"SwitchBotAPI",
|
|
130
|
+
"SwitchBotAuthenticationError",
|
|
131
|
+
"SwitchBotConnectionError",
|
|
132
|
+
"SwitchBotDeviceOfflineError",
|
|
133
|
+
"SwitchBotDeviceRequestError",
|
|
134
|
+
"SwitchBotError",
|
|
109
135
|
"SwitchCommands",
|
|
136
|
+
"SwitchbotCloudDeviceLockState",
|
|
110
137
|
"T",
|
|
111
138
|
"TVCommands",
|
|
112
139
|
"VacuumCleanMode",
|
|
@@ -60,7 +60,7 @@ class OthersCommands(Commands):
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
class CurtainCommands(Commands):
|
|
63
|
-
"""Curtain & Curtain3 commands."""
|
|
63
|
+
"""Curtain & Curtain3 & Curtain4 commands."""
|
|
64
64
|
|
|
65
65
|
SET_POSITION = "setPosition" # parameter(str): index0,mode0,position0 e.g. 0,ff,80
|
|
66
66
|
PAUSE = "pause"
|
|
@@ -68,7 +68,7 @@ class CurtainCommands(Commands):
|
|
|
68
68
|
@classmethod
|
|
69
69
|
def get_supported_devices(cls) -> list[str]:
|
|
70
70
|
"""Get supported devices."""
|
|
71
|
-
return ["Curtain", "Curtain 3"]
|
|
71
|
+
return ["Curtain", "Curtain 3", "Curtain 4"]
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
class LockCommands(Commands):
|
|
@@ -240,6 +240,8 @@ class RGBWWLightCommands(Commands):
|
|
|
240
240
|
"Color Bulb",
|
|
241
241
|
"RGBICWW Floor Lamp",
|
|
242
242
|
"RGBICWW Strip Light",
|
|
243
|
+
"Permanent Outdoor Lights",
|
|
244
|
+
"RGBICWW Light Bars",
|
|
243
245
|
]
|
|
244
246
|
|
|
245
247
|
|
|
@@ -257,6 +259,33 @@ class CeilingLightCommands(Commands):
|
|
|
257
259
|
return ["Ceiling Light", "Ceiling Light Pro"]
|
|
258
260
|
|
|
259
261
|
|
|
262
|
+
class RGBICWWCeilingLightCommands(Commands):
|
|
263
|
+
"""RGBICWW Ceiling Light commands.
|
|
264
|
+
|
|
265
|
+
The RGBICWW Ceiling Light has two independent sub-lights:
|
|
266
|
+
a main light (color temperature + brightness) and a
|
|
267
|
+
color light (RGB + brightness).
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
TURN_ON_MAIN_LIGHT = "turnOnMainLight"
|
|
271
|
+
TURN_OFF_MAIN_LIGHT = "turnOffMainLight"
|
|
272
|
+
TURN_ON_COLOR_LIGHT = "turnOnColorLight"
|
|
273
|
+
TURN_OFF_COLOR_LIGHT = "turnOffColorLight"
|
|
274
|
+
# 1-100
|
|
275
|
+
SET_MAIN_LIGHT_BRIGHTNESS = "setMainLightBrightness"
|
|
276
|
+
# 2700-6500
|
|
277
|
+
SET_MAIN_LIGHT_COLOR_TEMP = "setMainLightColorTemp"
|
|
278
|
+
# 1-100
|
|
279
|
+
SET_COLOR_LIGHT_BRIGHTNESS = "setColorLightBrightness"
|
|
280
|
+
# R:G:B
|
|
281
|
+
SET_COLOR_LIGHT_RGB = "setColorLightRGB"
|
|
282
|
+
|
|
283
|
+
@classmethod
|
|
284
|
+
def get_supported_devices(cls) -> list[str]:
|
|
285
|
+
"""Get supported devices."""
|
|
286
|
+
return ["RGBICWW Ceiling Light"]
|
|
287
|
+
|
|
288
|
+
|
|
260
289
|
class ArtFrameCommands(Commands):
|
|
261
290
|
"""AI Art Frame commands."""
|
|
262
291
|
|
|
@@ -267,7 +296,7 @@ class ArtFrameCommands(Commands):
|
|
|
267
296
|
@classmethod
|
|
268
297
|
def get_supported_devices(cls) -> list[str]:
|
|
269
298
|
"""Get supported devices."""
|
|
270
|
-
return ["AI Art Frame"]
|
|
299
|
+
return ["AI Art Frame", "AI Art Frame Luma"]
|
|
271
300
|
|
|
272
301
|
|
|
273
302
|
class DoorBellCommands(Commands):
|
|
@@ -374,7 +403,11 @@ class BatteryCirculatorFanCommands(Commands):
|
|
|
374
403
|
@classmethod
|
|
375
404
|
def get_supported_devices(cls) -> list[str]:
|
|
376
405
|
"""Get supported devices."""
|
|
377
|
-
return [
|
|
406
|
+
return [
|
|
407
|
+
"Circulator Fan",
|
|
408
|
+
"Battery Circulator Fan",
|
|
409
|
+
"Battery Circulator Fan 2 Pro",
|
|
410
|
+
]
|
|
378
411
|
|
|
379
412
|
|
|
380
413
|
class TVCommands(Commands):
|
|
@@ -448,4 +481,20 @@ class KeyPadCommands(Commands):
|
|
|
448
481
|
return ["Keypad", "Keypad Touch", "Keypad Vision", "Keypad Vision Pro"]
|
|
449
482
|
|
|
450
483
|
|
|
484
|
+
class KataFriendsCommands(Commands):
|
|
485
|
+
"""Kata Friends commands."""
|
|
486
|
+
|
|
487
|
+
MODE = "mode"
|
|
488
|
+
BACK_HOME = "backHome"
|
|
489
|
+
SNAPSHOTS = "snapshots"
|
|
490
|
+
CHILD_LOCK = "childLock"
|
|
491
|
+
PICTURE_TAKING = "pictureTaking"
|
|
492
|
+
TALK = "talk"
|
|
493
|
+
|
|
494
|
+
@classmethod
|
|
495
|
+
def get_supported_devices(cls) -> list[str]:
|
|
496
|
+
"""Get supported devices."""
|
|
497
|
+
return ["Kata Friends"]
|
|
498
|
+
|
|
499
|
+
|
|
451
500
|
T = TypeVar("T", bound=CommonCommands)
|
|
@@ -21,6 +21,16 @@ class BatteryCirculatorFanMode(StrEnum):
|
|
|
21
21
|
BABY = "baby"
|
|
22
22
|
|
|
23
23
|
|
|
24
|
+
class BatteryCirculatorFan2ProMode(StrEnum):
|
|
25
|
+
"""Fan mode types [Battery Circulator Fan2 Pro] API."""
|
|
26
|
+
|
|
27
|
+
DIRECT = "direct"
|
|
28
|
+
NATURAL = "natural"
|
|
29
|
+
SLEEP = "sleep"
|
|
30
|
+
BABY = "baby"
|
|
31
|
+
HURRICANE = "hurricane"
|
|
32
|
+
|
|
33
|
+
|
|
24
34
|
class AirPurifierMode(Enum):
|
|
25
35
|
"""mode types [Air Purifier] API."""
|
|
26
36
|
|
|
@@ -30,6 +40,20 @@ class AirPurifierMode(Enum):
|
|
|
30
40
|
PET = 4
|
|
31
41
|
|
|
32
42
|
|
|
43
|
+
class AirPurifierModeV2(Enum):
|
|
44
|
+
"""Air Purifier Modes."""
|
|
45
|
+
|
|
46
|
+
NORMAL = 1
|
|
47
|
+
AUTO = 2
|
|
48
|
+
SLEEP = 3
|
|
49
|
+
PET = 4
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def get_modes(cls) -> list[str]:
|
|
53
|
+
"""Return a list of available air purifier modes as lowercase strings."""
|
|
54
|
+
return [mode.name.lower() for mode in cls]
|
|
55
|
+
|
|
56
|
+
|
|
33
57
|
class AirPurifierFanGear(Enum):
|
|
34
58
|
"""Air Purifier Fan Gear."""
|
|
35
59
|
|
|
@@ -108,3 +132,78 @@ class BatteryLevel(Enum):
|
|
|
108
132
|
if 10 > value >= 0:
|
|
109
133
|
return cls.Critical
|
|
110
134
|
return cls.Unknown
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class Switch(Enum):
|
|
138
|
+
"""Switch parameter."""
|
|
139
|
+
|
|
140
|
+
ON = "on"
|
|
141
|
+
OFF = "off"
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
class KataFriendsMode(Enum):
|
|
145
|
+
"""Kata Friends Mode."""
|
|
146
|
+
|
|
147
|
+
NORMAL = "Normal"
|
|
148
|
+
STANDBY = "Standby"
|
|
149
|
+
SLEEP = "Sleep"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class KataFriendsWorkStatus(Enum):
|
|
153
|
+
"""Kata Friends Work Status."""
|
|
154
|
+
|
|
155
|
+
STROLLING = "Strolling"
|
|
156
|
+
WELCOMING_HOME = "Welcoming Home"
|
|
157
|
+
WAKE_UP_CALL = "Wake-up Call"
|
|
158
|
+
SLEEPING = "Sleeping"
|
|
159
|
+
PLAYING = "Playing"
|
|
160
|
+
RETURNING = "Returning"
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class KataFriendsHospitalizedStatus(Enum):
|
|
164
|
+
"""Kata Friends Hospitalized Status."""
|
|
165
|
+
|
|
166
|
+
NORMAL = 0
|
|
167
|
+
REPAIR = 1
|
|
168
|
+
MAINTAIN = 2
|
|
169
|
+
CLEAN = 3
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class Humidifier2Mode(Enum):
|
|
173
|
+
"""Enumerates the available modes for a SwitchBot humidifier2."""
|
|
174
|
+
|
|
175
|
+
HIGH = 1
|
|
176
|
+
MEDIUM = 2
|
|
177
|
+
LOW = 3
|
|
178
|
+
QUIET = 4
|
|
179
|
+
TARGET_HUMIDITY = 5
|
|
180
|
+
SLEEP = 6
|
|
181
|
+
AUTO = 7
|
|
182
|
+
DRYING_FILTER = 8
|
|
183
|
+
|
|
184
|
+
@classmethod
|
|
185
|
+
def get_modes(cls) -> list[str]:
|
|
186
|
+
"""Return a list of available humidifier2 modes as lowercase strings."""
|
|
187
|
+
return [mode.name.lower() for mode in cls]
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class SwitchbotCloudDeviceLockState(Enum):
|
|
191
|
+
"""Lock State."""
|
|
192
|
+
|
|
193
|
+
LOCKED = "locked"
|
|
194
|
+
UNLOCKED = "unlocked"
|
|
195
|
+
LOCKING = "locking"
|
|
196
|
+
UNLOCKING = "unlocking"
|
|
197
|
+
JAMMED = "jammed"
|
|
198
|
+
LATCH_BOLT_LOCKED = "latchBoltLocked"
|
|
199
|
+
HALF_LOCKED = "halfLocked"
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def get_states(cls) -> list[SwitchbotCloudDeviceLockState]:
|
|
203
|
+
"""Get lock states."""
|
|
204
|
+
return list(cls)
|
|
205
|
+
|
|
206
|
+
@classmethod
|
|
207
|
+
def get_values(cls) -> list[str]:
|
|
208
|
+
"""Get lock value."""
|
|
209
|
+
return [mode.value for mode in cls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|