__init__.py 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. CURTAIN_3 = "WoCurtain3"
  52. HUMIDIFIER = "WoHumi"
  53. # Deprecated import-only symbol; use PLUG_MINI_US or PLUG_MINI_JP to parse.
  54. PLUG_MINI = "WoPlug"
  55. PLUG_MINI_US = "WoPlugUS"
  56. PLUG_MINI_JP = "WoPlugJP"
  57. CONTACT_SENSOR = "WoContact"
  58. LIGHT_STRIP = "WoStrip"
  59. METER = "WoSensorTH"
  60. METER_PLUS = "WoMeterPlus"
  61. METER_PRO = "WoTHP"
  62. METER_PRO_CO2 = "WoTHPc"
  63. # Deprecated alias; use METER_PRO_CO2.
  64. METER_PRO_C = "WoTHPc"
  65. INDOOR_OUTDOOR_THERMO_HYGROMETER = "WoIOSensorTH"
  66. # Deprecated alias; use INDOOR_OUTDOOR_THERMO_HYGROMETER.
  67. IO_METER = "WoIOSensorTH"
  68. MOTION_SENSOR = "WoPresence"
  69. COLOR_BULB = "WoBulb"
  70. CEILING_LIGHT = "WoCeiling"
  71. CEILING_LIGHT_PRO = "WoCeilingPro"
  72. LOCK = "WoLock"
  73. LOCK_PRO = "WoLockPro"
  74. BLIND_TILT = "WoBlindTilt"
  75. HUB2 = "WoHub2"
  76. LEAK = "Leak Detector"
  77. KEYPAD = "WoKeypad"
  78. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  79. RELAY_SWITCH_1 = "Relay Switch 1"
  80. REMOTE = "WoRemote"
  81. UNIVERSAL_REMOTE = "WoUniversalRemote"
  82. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  83. ROLLER_SHADE = "Roller Shade"
  84. HUB_MINI = "WoLinkMini"
  85. HUBMINI_MATTER = "HubMini Matter"
  86. CIRCULATOR_FAN = "Circulator Fan"
  87. CIRCULATOR_FAN_PRO = "Circulator Fan Pro"
  88. STANDING_FAN = "Standing Fan"
  89. K20_VACUUM = "K20 Vacuum"
  90. S10_VACUUM = "S10 Vacuum"
  91. K10_VACUUM = "K10+ Vacuum"
  92. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  93. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  94. AIR_PURIFIER_US = "Air Purifier US"
  95. AIR_PURIFIER_JP = "Air Purifier JP"
  96. AIR_PURIFIER_TABLE_US = "Air Purifier Table US"
  97. AIR_PURIFIER_TABLE_JP = "Air Purifier Table JP"
  98. HUB3 = "Hub3"
  99. LOCK_ULTRA = "Lock Ultra"
  100. LOCK_LITE = "Lock Lite"
  101. GARAGE_DOOR_OPENER = "Garage Door Opener"
  102. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  103. STRIP_LIGHT_3 = "Strip Light 3"
  104. FLOOR_LAMP = "Floor Lamp"
  105. CANDLE_WARMER_LAMP = "Candle Warmer Lamp"
  106. PLUG_MINI_EU = "Plug Mini (EU)"
  107. RGBICWW_STRIP_LIGHT = "RGBICWW Strip Light"
  108. RGBICWW_FLOOR_LAMP = "RGBICWW Floor Lamp"
  109. RGBICWW_LIGHT_BARS = "RGBICWW Light Bars"
  110. RGBICWW_CEILING_LIGHT = "RGBICWW Ceiling Light"
  111. PERMANENT_OUTDOOR_LIGHT = "Permanent Outdoor Light"
  112. RGBIC_NEON_ROPE_LIGHT = "RGBIC Neon Rope Light"
  113. RGBIC_NEON_WIRE_ROPE_LIGHT = "RGBIC Neon Wire Rope Light"
  114. K11_VACUUM = "K11+ Vacuum"
  115. CLIMATE_PANEL = "Climate Panel"
  116. SMART_THERMOSTAT_RADIATOR = "Smart Thermostat Radiator"
  117. S20_VACUUM = "S20 Vacuum"
  118. PRESENCE_SENSOR = "Presence Sensor"
  119. ART_FRAME = "Art Frame"
  120. KEYPAD_VISION = "Keypad Vision"
  121. KEYPAD_VISION_PRO = "Keypad Vision Pro"
  122. LOCK_VISION_PRO = "Lock Vision Pro"
  123. LOCK_VISION = "Lock Vision"
  124. LOCK_PRO_WIFI = "Lock Pro Wifi"
  125. LOCK_ULTRA_MAX = "Lock Ultra Max"
  126. WEATHER_STATION = "Weather Station"
  127. __all__ = [
  128. "DEFAULT_RETRY_COUNT",
  129. "DEFAULT_RETRY_TIMEOUT",
  130. "DEFAULT_SCAN_TIMEOUT",
  131. "AirPurifierMode",
  132. "AirQualityLevel",
  133. "BulbColorMode",
  134. "CeilingLightColorMode",
  135. "CirculatorFanProMode",
  136. "ClimateAction",
  137. "ClimateMode",
  138. "ColorMode",
  139. "FanMode",
  140. "HorizontalOscillationAngle",
  141. "HumidifierAction",
  142. "HumidifierMode",
  143. "HumidifierWaterLevel",
  144. "LockStatus",
  145. "NightLightState",
  146. "SmartThermostatRadiatorMode",
  147. "StandingFanMode",
  148. "StripLightColorMode",
  149. "SwitchbotAccountConnectionError",
  150. "SwitchbotApiError",
  151. "SwitchbotAuthenticationError",
  152. "SwitchbotModel",
  153. "VerticalOscillationAngle",
  154. ]