__init__.py 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. from .meter_pro import (
  28. MeterProDateFormat,
  29. MeterProDisplaySource,
  30. MeterProDisplayZone,
  31. MeterProWeatherIcon,
  32. MeterProZoneIcon,
  33. )
  34. DEFAULT_RETRY_COUNT = 3
  35. DEFAULT_RETRY_TIMEOUT = 1
  36. DEFAULT_SCAN_TIMEOUT = 5
  37. class SwitchbotApiError(RuntimeError):
  38. """
  39. Raised when API call fails.
  40. This exception inherits from RuntimeError to avoid breaking existing code
  41. but will be changed to Exception in a future release.
  42. """
  43. class SwitchbotAuthenticationError(RuntimeError):
  44. """
  45. Raised when authentication fails.
  46. This exception inherits from RuntimeError to avoid breaking existing code
  47. but will be changed to Exception in a future release.
  48. """
  49. class SwitchbotAccountConnectionError(RuntimeError):
  50. """
  51. Raised when connection to Switchbot account fails.
  52. This exception inherits from RuntimeError to avoid breaking existing code
  53. but will be changed to Exception in a future release.
  54. """
  55. class SwitchbotModel(StrEnum):
  56. BOT = "WoHand"
  57. CURTAIN = "WoCurtain"
  58. CURTAIN_3 = "WoCurtain3"
  59. HUMIDIFIER = "WoHumi"
  60. # Deprecated import-only symbol; use PLUG_MINI_US or PLUG_MINI_JP to parse.
  61. PLUG_MINI = "WoPlug"
  62. PLUG_MINI_US = "WoPlugUS"
  63. PLUG_MINI_JP = "WoPlugJP"
  64. CONTACT_SENSOR = "WoContact"
  65. LIGHT_STRIP = "WoStrip"
  66. METER = "WoSensorTH"
  67. METER_PLUS = "WoMeterPlus"
  68. METER_PRO = "WoTHP"
  69. METER_PRO_CO2 = "WoTHPc"
  70. # Deprecated alias; use METER_PRO_CO2.
  71. METER_PRO_C = "WoTHPc"
  72. INDOOR_OUTDOOR_THERMO_HYGROMETER = "WoIOSensorTH"
  73. # Deprecated alias; use INDOOR_OUTDOOR_THERMO_HYGROMETER.
  74. IO_METER = "WoIOSensorTH"
  75. MOTION_SENSOR = "WoPresence"
  76. COLOR_BULB = "WoBulb"
  77. CEILING_LIGHT = "WoCeiling"
  78. CEILING_LIGHT_PRO = "WoCeilingPro"
  79. LOCK = "WoLock"
  80. LOCK_PRO = "WoLockPro"
  81. BLIND_TILT = "WoBlindTilt"
  82. HUB2 = "WoHub2"
  83. LEAK = "Leak Detector"
  84. KEYPAD = "WoKeypad"
  85. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  86. RELAY_SWITCH_1 = "Relay Switch 1"
  87. REMOTE = "WoRemote"
  88. UNIVERSAL_REMOTE = "WoUniversalRemote"
  89. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  90. ROLLER_SHADE = "Roller Shade"
  91. HUB_MINI = "WoLinkMini"
  92. HUBMINI_MATTER = "HubMini Matter"
  93. CIRCULATOR_FAN = "Circulator Fan"
  94. CIRCULATOR_FAN_PRO = "Circulator Fan Pro"
  95. STANDING_FAN = "Standing Fan"
  96. K20_VACUUM = "K20 Vacuum"
  97. S10_VACUUM = "S10 Vacuum"
  98. K10_VACUUM = "K10+ Vacuum"
  99. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  100. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  101. AIR_PURIFIER_US = "Air Purifier US"
  102. AIR_PURIFIER_JP = "Air Purifier JP"
  103. AIR_PURIFIER_TABLE_US = "Air Purifier Table US"
  104. AIR_PURIFIER_TABLE_JP = "Air Purifier Table JP"
  105. HUB3 = "Hub3"
  106. HUB4 = "Hub4"
  107. LOCK_ULTRA = "Lock Ultra"
  108. LOCK_LITE = "Lock Lite"
  109. GARAGE_DOOR_OPENER = "Garage Door Opener"
  110. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  111. STRIP_LIGHT_3 = "Strip Light 3"
  112. FLOOR_LAMP = "Floor Lamp"
  113. CANDLE_WARMER_LAMP = "Candle Warmer Lamp"
  114. PLUG_MINI_EU = "Plug Mini (EU)"
  115. PLUG_MINI_IT = "Plug Mini (IT)"
  116. OUTDOOR_PLUG_EU = "Outdoor Plug (EU)"
  117. RGBICWW_STRIP_LIGHT = "RGBICWW Strip Light"
  118. RGBICWW_FLOOR_LAMP = "RGBICWW Floor Lamp"
  119. RGBICWW_LIGHT_BARS = "RGBICWW Light Bars"
  120. RGBICWW_CEILING_LIGHT = "RGBICWW Ceiling Light"
  121. PERMANENT_OUTDOOR_LIGHT = "Permanent Outdoor Light"
  122. RGBIC_NEON_ROPE_LIGHT = "RGBIC Neon Rope Light"
  123. RGBIC_NEON_WIRE_ROPE_LIGHT = "RGBIC Neon Wire Rope Light"
  124. K11_VACUUM = "K11+ Vacuum"
  125. CLIMATE_PANEL = "Climate Panel"
  126. SMART_THERMOSTAT_RADIATOR = "Smart Thermostat Radiator"
  127. S20_VACUUM = "S20 Vacuum"
  128. PRESENCE_SENSOR = "Presence Sensor"
  129. ART_FRAME = "Art Frame"
  130. ART_FRAME_2 = "Art Frame 2"
  131. E_INK_PHOTO_MAGNET = "E Ink Photo Magnet"
  132. KEYPAD_VISION = "Keypad Vision"
  133. KEYPAD_VISION_PRO = "Keypad Vision Pro"
  134. LOCK_VISION_PRO = "Lock Vision Pro"
  135. LOCK_VISION = "Lock Vision"
  136. LOCK_PRO_WIFI = "Lock Pro Wifi"
  137. LOCK_ULTRA_MAX = "Lock Ultra Max"
  138. UWB_LOCK = "UWB Lock"
  139. LOCK_NANO = "Lock Nano"
  140. WEATHER_STATION = "Weather Station"
  141. __all__ = [
  142. "DEFAULT_RETRY_COUNT",
  143. "DEFAULT_RETRY_TIMEOUT",
  144. "DEFAULT_SCAN_TIMEOUT",
  145. "AirPurifierMode",
  146. "AirQualityLevel",
  147. "BulbColorMode",
  148. "CeilingLightColorMode",
  149. "CirculatorFanProMode",
  150. "ClimateAction",
  151. "ClimateMode",
  152. "ColorMode",
  153. "FanMode",
  154. "HorizontalOscillationAngle",
  155. "HumidifierAction",
  156. "HumidifierMode",
  157. "HumidifierWaterLevel",
  158. "LockStatus",
  159. "MeterProDateFormat",
  160. "MeterProDisplaySource",
  161. "MeterProDisplayZone",
  162. "MeterProWeatherIcon",
  163. "MeterProZoneIcon",
  164. "NightLightState",
  165. "QuickKeyFunction",
  166. "SmartThermostatRadiatorMode",
  167. "StandingFanMode",
  168. "StripLightColorMode",
  169. "SwitchbotAccountConnectionError",
  170. "SwitchbotApiError",
  171. "SwitchbotAuthenticationError",
  172. "SwitchbotModel",
  173. "VerticalOscillationAngle",
  174. ]