__init__.py 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. """Switchbot Device Consts Library."""
  2. from __future__ import annotations
  3. from ..enum import StrEnum
  4. from .air_purifier import AirPurifierMode, AirQualityLevel
  5. from .climate import ClimateAction, ClimateMode, SmartThermostatRadiatorMode
  6. from .evaporative_humidifier import (
  7. HumidifierAction,
  8. HumidifierMode,
  9. HumidifierWaterLevel,
  10. )
  11. from .fan import (
  12. CirculatorFanProMode,
  13. FanMode,
  14. HorizontalOscillationAngle,
  15. NightLightState,
  16. StandingFanMode,
  17. VerticalOscillationAngle,
  18. )
  19. from .light import (
  20. BulbColorMode,
  21. CeilingLightColorMode,
  22. ColorMode,
  23. StripLightColorMode,
  24. )
  25. # Preserve old LockStatus export for backwards compatibility
  26. from .lock import LockStatus
  27. DEFAULT_RETRY_COUNT = 3
  28. DEFAULT_RETRY_TIMEOUT = 1
  29. DEFAULT_SCAN_TIMEOUT = 5
  30. class SwitchbotApiError(RuntimeError):
  31. """
  32. Raised when API call fails.
  33. This exception inherits from RuntimeError to avoid breaking existing code
  34. but will be changed to Exception in a future release.
  35. """
  36. class SwitchbotAuthenticationError(RuntimeError):
  37. """
  38. Raised when authentication fails.
  39. This exception inherits from RuntimeError to avoid breaking existing code
  40. but will be changed to Exception in a future release.
  41. """
  42. class SwitchbotAccountConnectionError(RuntimeError):
  43. """
  44. Raised when connection to Switchbot account fails.
  45. This exception inherits from RuntimeError to avoid breaking existing code
  46. but will be changed to Exception in a future release.
  47. """
  48. class SwitchbotModel(StrEnum):
  49. BOT = "WoHand"
  50. CURTAIN = "WoCurtain"
  51. HUMIDIFIER = "WoHumi"
  52. PLUG_MINI = "WoPlug"
  53. CONTACT_SENSOR = "WoContact"
  54. LIGHT_STRIP = "WoStrip"
  55. METER = "WoSensorTH"
  56. METER_PRO = "WoTHP"
  57. METER_PRO_C = "WoTHPc"
  58. IO_METER = "WoIOSensorTH"
  59. MOTION_SENSOR = "WoPresence"
  60. COLOR_BULB = "WoBulb"
  61. CEILING_LIGHT = "WoCeiling"
  62. LOCK = "WoLock"
  63. LOCK_PRO = "WoLockPro"
  64. BLIND_TILT = "WoBlindTilt"
  65. HUB2 = "WoHub2"
  66. LEAK = "Leak Detector"
  67. KEYPAD = "WoKeypad"
  68. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  69. RELAY_SWITCH_1 = "Relay Switch 1"
  70. REMOTE = "WoRemote"
  71. UNIVERSAL_REMOTE = "WoUniversalRemote"
  72. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  73. ROLLER_SHADE = "Roller Shade"
  74. HUBMINI_MATTER = "HubMini Matter"
  75. CIRCULATOR_FAN = "Circulator Fan"
  76. CIRCULATOR_FAN_PRO = "Circulator Fan Pro"
  77. STANDING_FAN = "Standing Fan"
  78. K20_VACUUM = "K20 Vacuum"
  79. S10_VACUUM = "S10 Vacuum"
  80. K10_VACUUM = "K10+ Vacuum"
  81. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  82. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  83. AIR_PURIFIER_US = "Air Purifier US"
  84. AIR_PURIFIER_JP = "Air Purifier JP"
  85. AIR_PURIFIER_TABLE_US = "Air Purifier Table US"
  86. AIR_PURIFIER_TABLE_JP = "Air Purifier Table JP"
  87. HUB3 = "Hub3"
  88. LOCK_ULTRA = "Lock Ultra"
  89. LOCK_LITE = "Lock Lite"
  90. GARAGE_DOOR_OPENER = "Garage Door Opener"
  91. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  92. STRIP_LIGHT_3 = "Strip Light 3"
  93. FLOOR_LAMP = "Floor Lamp"
  94. CANDLE_WARMER_LAMP = "Candle Warmer Lamp"
  95. PLUG_MINI_EU = "Plug Mini (EU)"
  96. RGBICWW_STRIP_LIGHT = "RGBICWW Strip Light"
  97. RGBICWW_FLOOR_LAMP = "RGBICWW Floor Lamp"
  98. RGBICWW_LIGHT_BARS = "RGBICWW Light Bars"
  99. RGBICWW_CEILING_LIGHT = "RGBICWW Ceiling Light"
  100. PERMANENT_OUTDOOR_LIGHT = "Permanent Outdoor Light"
  101. RGBIC_NEON_ROPE_LIGHT = "RGBIC Neon Rope Light"
  102. RGBIC_NEON_WIRE_ROPE_LIGHT = "RGBIC Neon Wire Rope Light"
  103. K11_VACUUM = "K11+ Vacuum"
  104. CLIMATE_PANEL = "Climate Panel"
  105. SMART_THERMOSTAT_RADIATOR = "Smart Thermostat Radiator"
  106. S20_VACUUM = "S20 Vacuum"
  107. PRESENCE_SENSOR = "Presence Sensor"
  108. ART_FRAME = "Art Frame"
  109. KEYPAD_VISION = "Keypad Vision"
  110. KEYPAD_VISION_PRO = "Keypad Vision Pro"
  111. LOCK_VISION_PRO = "Lock Vision Pro"
  112. LOCK_VISION = "Lock Vision"
  113. LOCK_PRO_WIFI = "Lock Pro Wifi"
  114. WEATHER_STATION = "Weather Station"
  115. __all__ = [
  116. "DEFAULT_RETRY_COUNT",
  117. "DEFAULT_RETRY_TIMEOUT",
  118. "DEFAULT_SCAN_TIMEOUT",
  119. "AirPurifierMode",
  120. "AirQualityLevel",
  121. "BulbColorMode",
  122. "CeilingLightColorMode",
  123. "CirculatorFanProMode",
  124. "ClimateAction",
  125. "ClimateMode",
  126. "ColorMode",
  127. "FanMode",
  128. "HorizontalOscillationAngle",
  129. "HumidifierAction",
  130. "HumidifierMode",
  131. "HumidifierWaterLevel",
  132. "LockStatus",
  133. "NightLightState",
  134. "SmartThermostatRadiatorMode",
  135. "StandingFanMode",
  136. "StripLightColorMode",
  137. "SwitchbotAccountConnectionError",
  138. "SwitchbotApiError",
  139. "SwitchbotAuthenticationError",
  140. "SwitchbotModel",
  141. "VerticalOscillationAngle",
  142. ]