__init__.py 4.2 KB

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