pyvesync 3.0.0b0__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.
Files changed (49) hide show
  1. pyvesync/__init__.py +11 -0
  2. pyvesync/base_devices/__init__.py +35 -0
  3. pyvesync/base_devices/bulb_base.py +348 -0
  4. pyvesync/base_devices/fan_base.py +398 -0
  5. pyvesync/base_devices/fryer_base.py +69 -0
  6. pyvesync/base_devices/humidifier_base.py +460 -0
  7. pyvesync/base_devices/outlet_base.py +315 -0
  8. pyvesync/base_devices/purifier_base.py +518 -0
  9. pyvesync/base_devices/switch_base.py +270 -0
  10. pyvesync/base_devices/thermostat_base.py +277 -0
  11. pyvesync/base_devices/vesyncbasedevice.py +580 -0
  12. pyvesync/const.py +749 -0
  13. pyvesync/device_container.py +360 -0
  14. pyvesync/device_map.py +1090 -0
  15. pyvesync/devices/__init__.py +1 -0
  16. pyvesync/devices/vesyncbulb.py +1254 -0
  17. pyvesync/devices/vesyncfan.py +238 -0
  18. pyvesync/devices/vesynchumidifier.py +785 -0
  19. pyvesync/devices/vesynckitchen.py +664 -0
  20. pyvesync/devices/vesyncoutlet.py +962 -0
  21. pyvesync/devices/vesyncpurifier.py +951 -0
  22. pyvesync/devices/vesyncswitch.py +449 -0
  23. pyvesync/devices/vesyncthermostat.py +175 -0
  24. pyvesync/models/__init__.py +11 -0
  25. pyvesync/models/base_models.py +117 -0
  26. pyvesync/models/bulb_models.py +173 -0
  27. pyvesync/models/bypass_models.py +264 -0
  28. pyvesync/models/fan_models.py +46 -0
  29. pyvesync/models/fryer_models.py +28 -0
  30. pyvesync/models/home_models.py +158 -0
  31. pyvesync/models/humidifier_models.py +187 -0
  32. pyvesync/models/outlet_models.py +194 -0
  33. pyvesync/models/purifier_models.py +204 -0
  34. pyvesync/models/switch_models.py +89 -0
  35. pyvesync/models/thermostat_models.py +122 -0
  36. pyvesync/models/vesync_models.py +252 -0
  37. pyvesync/utils/__init__.py +1 -0
  38. pyvesync/utils/colors.py +248 -0
  39. pyvesync/utils/device_mixins.py +366 -0
  40. pyvesync/utils/enum_utils.py +25 -0
  41. pyvesync/utils/errors.py +859 -0
  42. pyvesync/utils/helpers.py +696 -0
  43. pyvesync/utils/logs.py +500 -0
  44. pyvesync/vesync.py +445 -0
  45. pyvesync-3.0.0b0.dist-info/METADATA +527 -0
  46. pyvesync-3.0.0b0.dist-info/RECORD +49 -0
  47. pyvesync-3.0.0b0.dist-info/WHEEL +5 -0
  48. pyvesync-3.0.0b0.dist-info/licenses/LICENSE +21 -0
  49. pyvesync-3.0.0b0.dist-info/top_level.txt +1 -0
pyvesync/const.py ADDED
@@ -0,0 +1,749 @@
1
+ """pyvesync library constants.
2
+
3
+ All device states and information are defined by Enums in this module.
4
+
5
+ Attributes:
6
+ DEFAULT_LANGUAGE (str): Default language for the VeSync app.
7
+ API_BASE_URL (str): Base URL for the VeSync API.
8
+ API_TIMEOUT (int): Timeout for API requests.
9
+ USER_AGENT (str): User agent for API requests.
10
+ DEFAULT_TZ (str): Default timezone for VeSync devices, updated by API after
11
+ login.
12
+ DEFAULT_REGION (str): Default region for VeSync devices,
13
+ updated by API when retrieving devices.
14
+ APP_VERSION (str): Version of the VeSync app.
15
+ PHONE_BRAND (str): Brand of the phone used to login to the VeSync app.
16
+ PHONE_OS (str): Operating system of the phone used to login to the VeSync app.
17
+ MOBILE_ID (str): Unique identifier for the phone used to login to the VeSync app.
18
+ USER_TYPE (str): User type for the VeSync app - internal app usage.
19
+ BYPASS_APP_V (str): Bypass app version
20
+ BYPASS_HEADER_UA (str): Bypass header user agent
21
+ TERMINAL_ID (str): Unique identifier for new API calls
22
+ """
23
+ from random import randint
24
+ from uuid import uuid1
25
+ from enum import StrEnum, IntEnum, Enum
26
+ from types import MappingProxyType
27
+ from pyvesync.utils.enum_utils import IntEnumMixin
28
+
29
+ DEFAULT_LANGUAGE = "en"
30
+ API_BASE_URL = "https://smartapi.vesync.com"
31
+ # If device is out of reach, the cloud api sends a timeout response after 7 seconds,
32
+ # using 8 here so there is time enough to catch that message
33
+ API_TIMEOUT = 8
34
+ USER_AGENT = (
35
+ "VeSync/3.2.39 (com.etekcity.vesyncPlatform; build:5; iOS 15.5.0) Alamofire/5.2.1"
36
+ )
37
+ DEFAULT_TZ = "America/New_York"
38
+ DEFAULT_REGION = "US"
39
+ APP_VERSION = "2.8.6"
40
+ PHONE_BRAND = "SM N9005"
41
+ PHONE_OS = "Android"
42
+ # MOBILE_ID = "1234567890123456"
43
+ MOBILE_ID = str(randint(1000000000000000, 9999999999999999)) # noqa: S311
44
+ USER_TYPE = "1"
45
+ BYPASS_APP_V = "VeSync 3.0.51"
46
+ BYPASS_HEADER_UA = "okhttp/3.12.1"
47
+ TERMINAL_ID = '2' + uuid1().hex
48
+
49
+
50
+ # Generic Constants
51
+
52
+
53
+ class ProductTypes(StrEnum):
54
+ """General device types enum."""
55
+ OUTLET = "Outlet"
56
+ BULB = "Bulb"
57
+ SWITCH = "Switch"
58
+ PURIFIER = "Purifier"
59
+ FAN = "Fan"
60
+ HUMIDIFIER = "Humidifier"
61
+ AIR_FRYER = "Air Fryer"
62
+ KITCHEN_THERMOMETER = "Kitchen Thermometer"
63
+ THERMOSTAT = "Thermostat"
64
+
65
+
66
+ class IntFlag(IntEnum):
67
+ """Integer flag to indicate if a device is not supported.
68
+
69
+ This is used by data models as a default value for feature attributes
70
+ that are not supported by all devices.
71
+
72
+ The default value is -999.
73
+
74
+ Attributes:
75
+ NOT_SUPPORTED: Device is not supported, -999
76
+ """
77
+ NOT_SUPPORTED = -999
78
+
79
+ def __str__(self) -> str:
80
+ """Return string representation of IntFlag."""
81
+ return str(self.name)
82
+
83
+
84
+ class StrFlag(StrEnum):
85
+ """String flag to indicate if a device is not supported.
86
+
87
+ This is used by data models as a default value for feature attributes
88
+ that are not supported by all devices.
89
+
90
+ The default value is "not_supported".
91
+
92
+ Attributes:
93
+ NOT_SUPPORTED: Device is not supported, "not_supported"
94
+ """
95
+ NOT_SUPPORTED = "not_supported"
96
+
97
+
98
+ class NightlightStatus(StrEnum):
99
+ """Nightlight status for VeSync devices.
100
+
101
+ Values can be converted to int and bool.
102
+
103
+ Attributes:
104
+ ON: Nightlight is on.
105
+ OFF: Nightlight is off.
106
+ AUTO: Nightlight is in auto mode.
107
+ UNKNOWN: Nightlight status is unknown.
108
+
109
+ Usage:
110
+ ```python
111
+ NightlightStatus.ON
112
+ # <NightlightStatus.ON: 'on'>
113
+ int(NightlightStatus.ON)
114
+ # 1
115
+ bool(NightlightStatus.ON)
116
+ # True
117
+ ```
118
+ """
119
+ ON = "on"
120
+ OFF = "off"
121
+ AUTO = "auto"
122
+ UNKNOWN = "unknown"
123
+
124
+ def __bool__(self) -> bool:
125
+ """Return True if nightlight is on or auto."""
126
+ return self in [NightlightStatus.ON, NightlightStatus.AUTO]
127
+
128
+ def __int__(self) -> int:
129
+ """Return integer representation of the enum."""
130
+ if self not in [NightlightStatus.ON, NightlightStatus.OFF]:
131
+ raise ValueError("Only ON and OFF are valid values for int conversion")
132
+ return int(self == NightlightStatus.ON)
133
+
134
+
135
+ class DeviceStatus(StrEnum):
136
+ """VeSync device status enum.
137
+
138
+ In addition to converting to int and bool values,
139
+ this enum can be used to convert from bool and int values
140
+ to corresponding string values.
141
+
142
+ Attributes:
143
+ ON: Device is on.
144
+ OFF: Device is off.
145
+ PAUSED: Device is paused.
146
+ STANDBY: Device is in standby mode.
147
+ IDLE: Device is idle.
148
+ RUNNING: Device is running.
149
+ UNKNOWN: Device status is unknown.
150
+
151
+ Usage:
152
+ ```python
153
+ DeviceStatus.ON
154
+ # <DeviceStatus.ON: 'on'>
155
+ bool(DeviceStatus.ON)
156
+ # True
157
+ int(DeviceStatus.ON)
158
+ # 1
159
+ DeviceStatus.from_int(1)
160
+ # 'on'
161
+ DeviceStatus.from_bool(True)
162
+ # 'on'
163
+ ```
164
+ """
165
+ ON = "on"
166
+ OFF = "off"
167
+ PAUSED = "paused"
168
+ STANDBY = "standby"
169
+ IDLE = "idle"
170
+ RUNNING = "running"
171
+ UNKNOWN = "unknown"
172
+
173
+ def __bool__(self) -> bool:
174
+ """Return True if device is on or running."""
175
+ return self in [DeviceStatus.ON, DeviceStatus.RUNNING]
176
+
177
+ def __int__(self) -> int:
178
+ """Return integer representation of the enum.
179
+
180
+ 1 is ON and RUNNING, 0 is OFF, PAUSED, STANDBY, IDLE.
181
+ -1 is UNKNOWN.
182
+ """
183
+ match self:
184
+ case DeviceStatus.ON | DeviceStatus.RUNNING:
185
+ return 1
186
+ case (
187
+ DeviceStatus.OFF
188
+ | DeviceStatus.PAUSED
189
+ | DeviceStatus.STANDBY
190
+ | DeviceStatus.IDLE
191
+ ):
192
+ return 0
193
+ return -1
194
+
195
+ @classmethod
196
+ def from_int(cls, value: int) -> str:
197
+ """Convert integer value to corresponding string.
198
+
199
+ If value is 1, return ON and if 0, return OFF.
200
+ If value is -999, return NOT_SUPPORTED.
201
+ """
202
+ if value == 1:
203
+ return cls.ON
204
+ if value == 0:
205
+ return cls.OFF
206
+ if value == IntFlag.NOT_SUPPORTED:
207
+ return StrFlag.NOT_SUPPORTED
208
+ return cls.UNKNOWN
209
+
210
+ @classmethod
211
+ def from_bool(cls, value: bool) -> 'DeviceStatus':
212
+ """Convert boolean value to corresponding string."""
213
+ return cls.ON if value else cls.OFF
214
+
215
+
216
+ class ConnectionStatus(StrEnum):
217
+ """VeSync device connection status enum.
218
+
219
+ Corresponding boolean value is True if device is online.
220
+
221
+ Attributes:
222
+ ONLINE: Device is online.
223
+ OFFLINE: Device is offline.
224
+ UNKNOWN: Device connection status is unknown.
225
+
226
+ Methods:
227
+ from_bool(value: bool | None) -> ConnectionStatus:
228
+ Convert boolean value to corresponding string.
229
+
230
+ Usage:
231
+ ```python
232
+ ConnectionStatus.ONLINE
233
+ # <ConnectionStatus.ONLINE: 'online'>
234
+ bool(ConnectionStatus.ONLINE)
235
+ # True
236
+ ConnectionStatus.ONLINE == ConnectionStatus.ONLINE
237
+ # True
238
+ ```
239
+ """
240
+ ONLINE = "online"
241
+ OFFLINE = "offline"
242
+ UNKNOWN = "unknown"
243
+
244
+ def __bool__(self) -> bool:
245
+ """Return True if device is online."""
246
+ return self == ConnectionStatus.ONLINE
247
+
248
+ @classmethod
249
+ def from_bool(cls, value: bool | None) -> 'ConnectionStatus':
250
+ """Convert boolean value to corresponding string.
251
+
252
+ Returns ConnectionStatus.ONLINE if True, else ConnectionStatus.OFFLINE.
253
+ """
254
+ return cls.ONLINE if value else cls.OFFLINE
255
+
256
+
257
+ class NightlightModes(StrEnum):
258
+ """Nightlight modes.
259
+
260
+ Attributes:
261
+ ON: Nightlight is on.
262
+ OFF: Nightlight is off.
263
+ DIM: Nightlight is dimmed.
264
+ AUTO: Nightlight is in auto mode.
265
+ UNKNOWN: Nightlight status is unknown.
266
+ """
267
+ ON = "on"
268
+ OFF = "off"
269
+ DIM = "dim"
270
+ AUTO = "auto"
271
+ UNKNOWN = "unknown"
272
+
273
+ def __bool__(self) -> bool:
274
+ """Return True if nightlight is on or auto.
275
+
276
+ Off and unknown are False, all other True.
277
+ """
278
+ return self in [
279
+ NightlightModes.ON, NightlightModes.AUTO, NightlightModes.DIM
280
+ ]
281
+
282
+
283
+ class ColorMode(StrEnum):
284
+ """VeSync bulb color modes.
285
+
286
+ Attributes:
287
+ RGB: RGB color mode.
288
+ HSV: HSV color mode.
289
+ WHITE: White color mode.
290
+ COLOR: Color mode.
291
+ """
292
+ RGB = "rgb"
293
+ HSV = "hsv"
294
+ WHITE = "white"
295
+ COLOR = "color"
296
+
297
+
298
+ # Purifier Constants
299
+
300
+ class AirQualityLevel(Enum):
301
+ """Representation of air quality levels as string and integers.
302
+
303
+ Attributes:
304
+ EXCELLENT: Air quality is excellent.
305
+ GOOD: Air quality is good.
306
+ MODERATE: Air quality is moderate.
307
+ POOR: Air quality is poor.
308
+ UNKNOWN: Air quality is unknown.
309
+
310
+ Methods:
311
+ from_string(value: str | None) -> AirQualityLevel:
312
+ Convert string value to corresponding integer.
313
+ from_int(value: int | None) -> AirQualityLevel:
314
+ Convert integer value to corresponding string.
315
+
316
+ Note:
317
+ Alias for "very good" is "excellent".
318
+ Alias for "bad" is "poor".
319
+
320
+ Usage:
321
+ ```python
322
+ AirQualityLevels.EXCELLENT
323
+ # <AirQualityLevels.EXCELLENT: 1>
324
+ AirQualityLevels.from_string("excellent")
325
+ # 1
326
+ AirQualityLevels.from_int(1)
327
+ # "excellent"
328
+ int(AirQualityLevels.EXCELLENT)
329
+ # 1
330
+ str(AirQualityLevels.EXCELLENT)
331
+ # "excellent"
332
+ from_string("good")
333
+ # <AirQualityLevels.GOOD: 2>
334
+ from_int(2)
335
+ # "good"
336
+ ```
337
+ """
338
+ EXCELLENT = 1
339
+ GOOD = 2
340
+ MODERATE = 3
341
+ POOR = 4
342
+ UNKNOWN = -1
343
+
344
+ def __int__(self) -> int:
345
+ """Return integer representation of the enum."""
346
+ return self.value
347
+
348
+ def __str__(self) -> str:
349
+ """Return string representation of the enum."""
350
+ return self.name.lower()
351
+
352
+ @classmethod
353
+ def from_string(cls, value: str | None) -> 'AirQualityLevel':
354
+ """Convert string value to corresponding integer.
355
+
356
+ Get enum from string value to normalize different values of the same
357
+ format.
358
+
359
+ Note:
360
+ Values are excellent, good, moderate and poor. Aliases are:
361
+ very good for excellent and bad for poor. Unknown is returned
362
+ if value is None or not in the list.
363
+ """
364
+ _string_to_enum = MappingProxyType({
365
+ "excellent": cls.EXCELLENT,
366
+ "very good": cls.EXCELLENT, # Alias
367
+ "good": cls.GOOD,
368
+ "moderate": cls.MODERATE,
369
+ "poor": cls.POOR,
370
+ "bad": cls.POOR, # Alias
371
+ "unknown": cls.UNKNOWN
372
+ })
373
+ if isinstance(value, str) and value.lower() in _string_to_enum:
374
+ return AirQualityLevel(_string_to_enum[value.lower()])
375
+ return cls.UNKNOWN
376
+
377
+ @classmethod
378
+ def from_int(cls, value: int | None) -> 'AirQualityLevel':
379
+ """Convert integer value to corresponding string."""
380
+ if value in [itm.value for itm in cls]:
381
+ return cls(value)
382
+ return cls.UNKNOWN
383
+
384
+
385
+ class PurifierAutoPreference(StrEnum):
386
+ """Preference Levels for Purifier Auto Mode.
387
+
388
+ Attributes:
389
+ DEFAULT: Default preference level.
390
+ EFFICIENT: Efficient preference level.
391
+ QUIET: Quiet preference level.
392
+ UNKNOWN: Unknown preference level.
393
+ """
394
+ DEFAULT = "default"
395
+ EFFICIENT = "efficient"
396
+ QUIET = "quiet"
397
+ UNKNOWN = "unknown"
398
+
399
+
400
+ # Fan Constants
401
+
402
+ class FanSleepPreference(StrEnum):
403
+ """Sleep mode preferences for VeSync fans.
404
+
405
+ Attributes:
406
+ DEFAULT: Default sleep mode.
407
+ ADVANCED: Advanced sleep mode.
408
+ TURBO: Turbo sleep mode.
409
+ EFFICIENT: Efficient sleep mode.
410
+ QUIET: Quiet sleep mode.
411
+ UNKNOWN: Unknown sleep mode.
412
+ """
413
+ DEFAULT = "default"
414
+ ADVANCED = "advanced"
415
+ TURBO = "turbo"
416
+ EFFICIENT = "efficient"
417
+ QUIET = "quiet"
418
+ TEMP_SENSE = "tempSense"
419
+ KIDS = "kids"
420
+ UNKNOWN = "unknown"
421
+
422
+
423
+ # Device Features
424
+
425
+ class Features(StrEnum):
426
+ """Base Class for Features Enum to appease typing."""
427
+
428
+
429
+ # Device Features
430
+
431
+ class HumidifierFeatures(Features):
432
+ """VeSync humidifier features.
433
+
434
+ Attributes:
435
+ ONOFF: Device on/off status.
436
+ CHILD_LOCK: Child lock status.
437
+ NIGHTLIGHT: Nightlight status.
438
+ WATER_LEVEL: Water level status.
439
+ WARM_MIST: Warm mist status.
440
+ AUTO_STOP: Auto stop when target humidity is reached.
441
+ Different from auto, which adjusts fan level to maintain humidity.
442
+ """
443
+ ONOFF = "onoff"
444
+ CHILD_LOCK = "child_lock"
445
+ NIGHTLIGHT = "night_light"
446
+ WATER_LEVEL = "water_level"
447
+ WARM_MIST = "warm_mist"
448
+ AUTO_STOP = "auto_stop"
449
+ NIGHTLIGHT_BRIGHTNESS = "nightlight_brightness"
450
+ DRYING_MODE = "drying_mode"
451
+
452
+
453
+ class PurifierFeatures(Features):
454
+ """VeSync air purifier features.
455
+
456
+ Attributes:
457
+ CHILD_LOCK: Child lock status.
458
+ NIGHTLIGHT: Nightlight status.
459
+ AIR_QUALITY: Air quality status.
460
+ VENT_ANGLE: Vent angle status.
461
+ LIGHT_DETECT: Light detection status.
462
+ PM25: PM2.5 level status.
463
+ PM10: PM10 level status.
464
+ PM1: PM1 level status.
465
+ AQPERCENT: Air quality percentage status.
466
+ RESET_FILTER: Reset filter status.
467
+ """
468
+ RESET_FILTER = "reset_filter"
469
+ CHILD_LOCK = "child_lock"
470
+ NIGHTLIGHT = "night_light"
471
+ AIR_QUALITY = "air_quality"
472
+ VENT_ANGLE = "fan_rotate"
473
+ LIGHT_DETECT = "light_detect"
474
+ PM25 = "pm25"
475
+ PM10 = "pm10"
476
+ PM1 = "pm1"
477
+ AQPERCENT = "aq_percent"
478
+
479
+
480
+ class PurifierStringLevels(Features):
481
+ """String levels for Air Purifier fan speed.
482
+
483
+ Attributes:
484
+ LOW: Low fan speed.
485
+ MEDIUM: Medium fan speed.
486
+ HIGH: High fan speed.
487
+ """
488
+ LOW = "low"
489
+ MEDIUM = "medium"
490
+ HIGH = "high"
491
+
492
+
493
+ class BulbFeatures(Features):
494
+ """VeSync bulb features.
495
+
496
+ Attributes:
497
+ ONOFF: Device on/off status.
498
+ DIMMABLE: Dimmable status.
499
+ COLOR_TEMP: Color temperature status.
500
+ MULTICOLOR: Multicolor status.
501
+ """
502
+ ONOFF = "onoff"
503
+ DIMMABLE = "dimmable"
504
+ COLOR_TEMP = "color_temp"
505
+ MULTICOLOR = "multicolor"
506
+
507
+
508
+ class OutletFeatures(Features):
509
+ """VeSync outlet features.
510
+
511
+ Attributes:
512
+ ONOFF: Device on/off status.
513
+ ENERGY_MONITOR: Energy monitor status.
514
+ NIGHTLIGHT: Nightlight status.
515
+ """
516
+ ONOFF = "onoff"
517
+ ENERGY_MONITOR = "energy_monitor"
518
+ NIGHTLIGHT = "nightlight"
519
+
520
+
521
+ class SwitchFeatures(Features):
522
+ """VeSync switch features.
523
+
524
+ Attributes:
525
+ ONOFF: Device on/off status.
526
+ DIMMABLE: Dimmable status.
527
+ INDICATOR_LIGHT: Indicator light status.
528
+ BACKLIGHT: Backlight status.
529
+ BACKLIGHT_RGB: RGB backlight status.
530
+ """
531
+ ONOFF = "onoff"
532
+ DIMMABLE = "dimmable"
533
+ INDICATOR_LIGHT = "indicator_light"
534
+ BACKLIGHT = "backlight"
535
+ BACKLIGHT_RGB = "backlight_rgb"
536
+
537
+
538
+ class FanFeatures(Features):
539
+ """VeSync fan features."""
540
+ OSCILLATION = "oscillation"
541
+ SOUND = "sound"
542
+ DISPLAYING_TYPE = "displaying_type" # Unknown functionality
543
+
544
+
545
+ # Modes
546
+
547
+ class PurifierModes(Features):
548
+ """VeSync air purifier modes.
549
+
550
+ Attributes:
551
+ AUTO: Auto mode.
552
+ MANUAL: Manual mode.
553
+ SLEEP: Sleep mode.
554
+ TURBO: Turbo mode.
555
+ PET: Pet mode.
556
+ UNKNOWN: Unknown mode.
557
+ """
558
+ AUTO = "auto"
559
+ MANUAL = "manual"
560
+ SLEEP = "sleep"
561
+ TURBO = "turbo"
562
+ PET = "pet"
563
+ UNKNOWN = "unknown"
564
+
565
+
566
+ class HumidifierModes(Features):
567
+ """VeSync humidifier modes.
568
+
569
+ Attributes:
570
+ AUTO: Auto mode.
571
+ MANUAL: Manual mode.
572
+ HUMIDITY: Humidity mode.
573
+ SLEEP: Sleep mode.
574
+ TURBO: Turbo mode.
575
+ PET: Pet mode.
576
+ UNKNOWN: Unknown mode.
577
+ AUTOPRO: AutoPro mode.
578
+ """
579
+ AUTO = "auto"
580
+ MANUAL = "manual"
581
+ HUMIDITY = "humidity"
582
+ SLEEP = "sleep"
583
+ TURBO = "turbo"
584
+ PET = "pet"
585
+ UNKNOWN = "unknown"
586
+ AUTOPRO = "autopro"
587
+
588
+
589
+ class FanModes(StrEnum):
590
+ """VeSync fan modes.
591
+
592
+ Attributes:
593
+ AUTO: Auto mode.
594
+ NORMAL: Normal mode.
595
+ MANUAL: Manual mode.
596
+ SLEEP: Sleep mode.
597
+ TURBO: Turbo mode.
598
+ PET: Pet mode.
599
+ UNKNOWN: Unknown mode.
600
+ ADVANCED_SLEEP: Advanced sleep mode.
601
+ """
602
+ AUTO = "auto"
603
+ NORMAL = "normal"
604
+ MANUAL = "normal"
605
+ SLEEP = "advancedSleep"
606
+ TURBO = "turbo"
607
+ PET = "pet"
608
+ UNKNOWN = "unknown"
609
+ ADVANCED_SLEEP = "advancedSleep"
610
+
611
+
612
+ # Air Fryer Constants
613
+
614
+ AIRFRYER_PID_MAP = {
615
+ "WiFi_SKA_AirFryer137_US": "wnxwqs76gknqyzjn",
616
+ "WiFi_SKA_AirFryer158_US": "2cl8hmafsthl65bd",
617
+ "WiFi_AirFryer_CS158-AF_EU": "8t8op7pcvzlsbosm"
618
+ }
619
+ """PID's for VeSync Air Fryers based on ConfigModule."""
620
+
621
+
622
+ # Thermostat Constants
623
+
624
+ class ThermostatWorkModes(IntEnum):
625
+ """Working modes for VeSync Aura thermostats.
626
+
627
+ Based on the VeSync app and API values.
628
+
629
+ Attributes:
630
+ OFF: Thermostat is off (0).
631
+ HEAT: Thermostat is in heating mode (1).
632
+ COOL: Thermostat is in cooling mode (2).
633
+ AUTO: Thermostat is in auto mode (3).
634
+ EM_HEAT: Thermostat is in emergency heating mode (4).
635
+ SMART_AUTO: Thermostat is in smart auto mode (5).
636
+ """
637
+ OFF = 0
638
+ HEAT = 1
639
+ COOL = 2
640
+ AUTO = 3
641
+ EM_HEAT = 4
642
+ SMART_AUTO = 5
643
+
644
+
645
+ class ThermostatFanModes(IntEnum):
646
+ """Fan modes for VeSync Aura thermostats.
647
+
648
+ Based on the VeSync app and API values.
649
+
650
+ Attributes:
651
+ AUTO: Fan is in auto mode (1).
652
+ ON: Fan is on (2).
653
+ CIRCULATE: Fan is in circulate mode (3).
654
+ """
655
+ AUTO = 1
656
+ ON = 2
657
+ CIRCULATE = 3
658
+
659
+
660
+ class ThermostatHoldOptions(IntEnumMixin):
661
+ """Hold options for VeSync Aura thermostats.
662
+
663
+ Attributes:
664
+ UNTIL_NEXT_SCHEDULED_ITEM: Hold until next scheduled item (2).
665
+ TWO_HOURS: Hold for two hours (3).
666
+ FOUR_HOURS: Hold for four hours (4).
667
+ PERMANENTLY: Hold permanently (5).
668
+ """
669
+ UNTIL_NEXT_SCHEDULED_ITEM = 2
670
+ TWO_HOURS = 3
671
+ FOUR_HOURS = 4
672
+ PERMANENTLY = 5
673
+
674
+
675
+ class ThermostatHoldStatus(IntEnumMixin):
676
+ """Set the hold status of the thermostat.
677
+
678
+ Attributes:
679
+ SET: Set the hold status (1).
680
+ CANCEL: Cancel the hold status (0).
681
+ """
682
+ SET = 1
683
+ CANCEL = 0
684
+
685
+
686
+ class ThermostatScheduleOrHoldOptions(IntEnumMixin):
687
+ """Schedule or hold options for VeSync Aura thermostats."""
688
+ NOT_SCHEDULE_NOT_HOLD = 0
689
+ ON_SCHEDULE = 1
690
+ ON_HOLD = 2
691
+ VACATION = 3
692
+
693
+
694
+ class ThermostatEcoTypes(IntEnumMixin):
695
+ """Eco types for VeSync Aura thermostats."""
696
+ COMFORT_SECOND = 1
697
+ COMFORT_FIRST = 2
698
+ BALANCE = 3
699
+ ECO_FIRST = 4
700
+ ECO_SECOND = 5
701
+
702
+
703
+ class ThermostatRoutineTypes(IntEnumMixin):
704
+ """Routine types for VeSync Aura thermostats."""
705
+ HOME = 2
706
+ AWAY = 1
707
+ SLEEP = 3
708
+ CUSTOM = 4
709
+
710
+
711
+ class ThermostatAlarmCodes(IntEnumMixin):
712
+ """Alarm codes for VeSync Aura thermostats."""
713
+ HEAT_COOL = 100
714
+ ABOVE_SAFE_TEMP = 102
715
+ HEAT_RUNNING_TIME_TOO_LONG = 104
716
+
717
+
718
+ class ThermostatReminderCodes(IntEnumMixin):
719
+ """Reminder codes for VeSync Aura thermostats."""
720
+ FILTER = 150
721
+ HVAC = 151
722
+
723
+
724
+ class ThermostatWorkStatusCodes(IntEnumMixin):
725
+ """Work status codes for VeSync Aura thermostats."""
726
+ OFF = 0
727
+ HEATING = 1
728
+ COOLING = 2
729
+ EM_HEATING = 3
730
+
731
+
732
+ class ThermostatFanStatus(IntEnumMixin):
733
+ """Fan Status Enum for Aura Thermostats."""
734
+ OFF = 0
735
+ ON = 1
736
+
737
+
738
+ class ThermostatConst:
739
+ """Constants for VeSync Aura thermostats."""
740
+ ReminderCode = ThermostatReminderCodes
741
+ AlarmCode = ThermostatAlarmCodes
742
+ WorkMode = ThermostatWorkModes
743
+ FanStatus = ThermostatFanStatus
744
+ FanMode = ThermostatFanModes
745
+ HoldOption = ThermostatHoldOptions
746
+ EcoType = ThermostatEcoTypes
747
+ RoutineType = ThermostatRoutineTypes
748
+ ScheduleOrHoldOption = ThermostatScheduleOrHoldOptions
749
+ WorkStatus = ThermostatWorkStatusCodes