__init__.py 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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, QuickKeyFunction
  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. HUB4 = "Hub4"
  100. LOCK_ULTRA = "Lock Ultra"
  101. LOCK_LITE = "Lock Lite"
  102. GARAGE_DOOR_OPENER = "Garage Door Opener"
  103. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  104. STRIP_LIGHT_3 = "Strip Light 3"
  105. FLOOR_LAMP = "Floor Lamp"
  106. CANDLE_WARMER_LAMP = "Candle Warmer Lamp"
  107. PLUG_MINI_EU = "Plug Mini (EU)"
  108. PLUG_MINI_IT = "Plug Mini (IT)"
  109. RGBICWW_STRIP_LIGHT = "RGBICWW Strip Light"
  110. RGBICWW_FLOOR_LAMP = "RGBICWW Floor Lamp"
  111. RGBICWW_LIGHT_BARS = "RGBICWW Light Bars"
  112. RGBICWW_CEILING_LIGHT = "RGBICWW Ceiling Light"
  113. PERMANENT_OUTDOOR_LIGHT = "Permanent Outdoor Light"
  114. RGBIC_NEON_ROPE_LIGHT = "RGBIC Neon Rope Light"
  115. RGBIC_NEON_WIRE_ROPE_LIGHT = "RGBIC Neon Wire Rope Light"
  116. K11_VACUUM = "K11+ Vacuum"
  117. CLIMATE_PANEL = "Climate Panel"
  118. SMART_THERMOSTAT_RADIATOR = "Smart Thermostat Radiator"
  119. S20_VACUUM = "S20 Vacuum"
  120. PRESENCE_SENSOR = "Presence Sensor"
  121. ART_FRAME = "Art Frame"
  122. KEYPAD_VISION = "Keypad Vision"
  123. KEYPAD_VISION_PRO = "Keypad Vision Pro"
  124. LOCK_VISION_PRO = "Lock Vision Pro"
  125. LOCK_VISION = "Lock Vision"
  126. LOCK_PRO_WIFI = "Lock Pro Wifi"
  127. LOCK_ULTRA_MAX = "Lock Ultra Max"
  128. WEATHER_STATION = "Weather Station"
  129. __all__ = [
  130. "DEFAULT_RETRY_COUNT",
  131. "DEFAULT_RETRY_TIMEOUT",
  132. "DEFAULT_SCAN_TIMEOUT",
  133. "AirPurifierMode",
  134. "AirQualityLevel",
  135. "BulbColorMode",
  136. "CeilingLightColorMode",
  137. "CirculatorFanProMode",
  138. "ClimateAction",
  139. "ClimateMode",
  140. "ColorMode",
  141. "FanMode",
  142. "HorizontalOscillationAngle",
  143. "HumidifierAction",
  144. "HumidifierMode",
  145. "HumidifierWaterLevel",
  146. "LockStatus",
  147. "NightLightState",
  148. "QuickKeyFunction",
  149. "SmartThermostatRadiatorMode",
  150. "StandingFanMode",
  151. "StripLightColorMode",
  152. "SwitchbotAccountConnectionError",
  153. "SwitchbotApiError",
  154. "SwitchbotAuthenticationError",
  155. "SwitchbotModel",
  156. "VerticalOscillationAngle",
  157. ]