__init__.py 2.9 KB

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