__init__.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. """Switchbot Device Consts Library."""
  2. from __future__ import annotations
  3. from ..enum import StrEnum
  4. from .air_purifier import AirPurifierMode
  5. from .evaporative_humidifier import (
  6. HumidifierAction,
  7. HumidifierMode,
  8. HumidifierWaterLevel,
  9. )
  10. from .fan import FanMode
  11. from .light import (
  12. BulbColorMode,
  13. CeilingLightColorMode,
  14. ColorMode,
  15. StripLightColorMode,
  16. )
  17. # Preserve old LockStatus export for backwards compatibility
  18. from .lock import LockStatus
  19. DEFAULT_RETRY_COUNT = 3
  20. DEFAULT_RETRY_TIMEOUT = 1
  21. DEFAULT_SCAN_TIMEOUT = 5
  22. class SwitchbotApiError(RuntimeError):
  23. """
  24. Raised when API call fails.
  25. This exception inherits from RuntimeError to avoid breaking existing code
  26. but will be changed to Exception in a future release.
  27. """
  28. class SwitchbotAuthenticationError(RuntimeError):
  29. """
  30. Raised when authentication fails.
  31. This exception inherits from RuntimeError to avoid breaking existing code
  32. but will be changed to Exception in a future release.
  33. """
  34. class SwitchbotAccountConnectionError(RuntimeError):
  35. """
  36. Raised when connection to Switchbot account fails.
  37. This exception inherits from RuntimeError to avoid breaking existing code
  38. but will be changed to Exception in a future release.
  39. """
  40. class SwitchbotModel(StrEnum):
  41. BOT = "WoHand"
  42. CURTAIN = "WoCurtain"
  43. HUMIDIFIER = "WoHumi"
  44. PLUG_MINI = "WoPlug"
  45. CONTACT_SENSOR = "WoContact"
  46. LIGHT_STRIP = "WoStrip"
  47. METER = "WoSensorTH"
  48. METER_PRO = "WoTHP"
  49. METER_PRO_C = "WoTHPc"
  50. IO_METER = "WoIOSensorTH"
  51. MOTION_SENSOR = "WoPresence"
  52. COLOR_BULB = "WoBulb"
  53. CEILING_LIGHT = "WoCeiling"
  54. LOCK = "WoLock"
  55. LOCK_PRO = "WoLockPro"
  56. BLIND_TILT = "WoBlindTilt"
  57. HUB2 = "WoHub2"
  58. LEAK = "Leak Detector"
  59. KEYPAD = "WoKeypad"
  60. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  61. RELAY_SWITCH_1 = "Relay Switch 1"
  62. REMOTE = "WoRemote"
  63. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  64. ROLLER_SHADE = "Roller Shade"
  65. HUBMINI_MATTER = "HubMini Matter"
  66. CIRCULATOR_FAN = "Circulator Fan"
  67. K20_VACUUM = "K20 Vacuum"
  68. S10_VACUUM = "S10 Vacuum"
  69. K10_VACUUM = "K10+ Vacuum"
  70. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  71. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  72. AIR_PURIFIER = "Air Purifier"
  73. AIR_PURIFIER_TABLE = "Air Purifier Table"
  74. HUB3 = "Hub3"
  75. LOCK_ULTRA = "Lock Ultra"
  76. LOCK_LITE = "Lock Lite"
  77. GARAGE_DOOR_OPENER = "Garage Door Opener"
  78. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  79. STRIP_LIGHT_3 = "Strip Light 3"
  80. FLOOR_LAMP = "Floor Lamp"
  81. __all__ = [
  82. "DEFAULT_RETRY_COUNT",
  83. "DEFAULT_RETRY_TIMEOUT",
  84. "DEFAULT_SCAN_TIMEOUT",
  85. "AirPurifierMode",
  86. "BulbColorMode",
  87. "CeilingLightColorMode",
  88. "ColorMode",
  89. "FanMode",
  90. "HumidifierAction",
  91. "HumidifierMode",
  92. "HumidifierWaterLevel",
  93. "LockStatus",
  94. "StripLightColorMode",
  95. "SwitchbotAccountConnectionError",
  96. "SwitchbotApiError",
  97. "SwitchbotAuthenticationError",
  98. "SwitchbotModel",
  99. ]