__init__.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. """Switchbot Device Consts Library."""
  2. from __future__ import annotations
  3. from ..enum import StrEnum
  4. from .air_purifier import AirPurifierMode
  5. from .climate import ClimateAction, ClimateMode, SmartThermostatRadiatorMode
  6. from .evaporative_humidifier import (
  7. HumidifierAction,
  8. HumidifierMode,
  9. HumidifierWaterLevel,
  10. )
  11. from .fan import FanMode
  12. from .light import (
  13. BulbColorMode,
  14. CeilingLightColorMode,
  15. ColorMode,
  16. StripLightColorMode,
  17. )
  18. # Preserve old LockStatus export for backwards compatibility
  19. from .lock import LockStatus
  20. DEFAULT_RETRY_COUNT = 3
  21. DEFAULT_RETRY_TIMEOUT = 1
  22. DEFAULT_SCAN_TIMEOUT = 5
  23. class SwitchbotApiError(RuntimeError):
  24. """
  25. Raised when API call fails.
  26. This exception inherits from RuntimeError to avoid breaking existing code
  27. but will be changed to Exception in a future release.
  28. """
  29. class SwitchbotAuthenticationError(RuntimeError):
  30. """
  31. Raised when authentication 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 SwitchbotAccountConnectionError(RuntimeError):
  36. """
  37. Raised when connection to Switchbot account 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 SwitchbotModel(StrEnum):
  42. BOT = "WoHand"
  43. CURTAIN = "WoCurtain"
  44. HUMIDIFIER = "WoHumi"
  45. PLUG_MINI = "WoPlug"
  46. CONTACT_SENSOR = "WoContact"
  47. LIGHT_STRIP = "WoStrip"
  48. METER = "WoSensorTH"
  49. METER_PRO = "WoTHP"
  50. METER_PRO_C = "WoTHPc"
  51. IO_METER = "WoIOSensorTH"
  52. MOTION_SENSOR = "WoPresence"
  53. COLOR_BULB = "WoBulb"
  54. CEILING_LIGHT = "WoCeiling"
  55. LOCK = "WoLock"
  56. LOCK_PRO = "WoLockPro"
  57. BLIND_TILT = "WoBlindTilt"
  58. HUB2 = "WoHub2"
  59. LEAK = "Leak Detector"
  60. KEYPAD = "WoKeypad"
  61. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  62. RELAY_SWITCH_1 = "Relay Switch 1"
  63. REMOTE = "WoRemote"
  64. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  65. ROLLER_SHADE = "Roller Shade"
  66. HUBMINI_MATTER = "HubMini Matter"
  67. CIRCULATOR_FAN = "Circulator Fan"
  68. K20_VACUUM = "K20 Vacuum"
  69. S10_VACUUM = "S10 Vacuum"
  70. K10_VACUUM = "K10+ Vacuum"
  71. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  72. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  73. AIR_PURIFIER = "Air Purifier"
  74. AIR_PURIFIER_TABLE = "Air Purifier Table"
  75. HUB3 = "Hub3"
  76. LOCK_ULTRA = "Lock Ultra"
  77. LOCK_LITE = "Lock Lite"
  78. GARAGE_DOOR_OPENER = "Garage Door Opener"
  79. RELAY_SWITCH_2PM = "Relay Switch 2PM"
  80. STRIP_LIGHT_3 = "Strip Light 3"
  81. FLOOR_LAMP = "Floor Lamp"
  82. PLUG_MINI_EU = "Plug Mini (EU)"
  83. RGBICWW_STRIP_LIGHT = "RGBICWW Strip Light"
  84. RGBICWW_FLOOR_LAMP = "RGBICWW Floor Lamp"
  85. K11_VACUUM = "K11+ Vacuum"
  86. CLIMATE_PANEL = "Climate Panel"
  87. SMART_THERMOSTAT_RADIATOR = "Smart Thermostat Radiator"
  88. __all__ = [
  89. "DEFAULT_RETRY_COUNT",
  90. "DEFAULT_RETRY_TIMEOUT",
  91. "DEFAULT_SCAN_TIMEOUT",
  92. "AirPurifierMode",
  93. "BulbColorMode",
  94. "CeilingLightColorMode",
  95. "ClimateAction",
  96. "ClimateMode",
  97. "ColorMode",
  98. "FanMode",
  99. "HumidifierAction",
  100. "HumidifierMode",
  101. "HumidifierWaterLevel",
  102. "LockStatus",
  103. "SmartThermostatRadiatorMode",
  104. "StripLightColorMode",
  105. "SwitchbotAccountConnectionError",
  106. "SwitchbotApiError",
  107. "SwitchbotAuthenticationError",
  108. "SwitchbotModel",
  109. ]