__init__.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. """Switchbot Device Consts Library."""
  2. from __future__ import annotations
  3. from ..enum import StrEnum
  4. from .fan import FanMode
  5. # Preserve old LockStatus export for backwards compatibility
  6. from .lock import LockStatus
  7. DEFAULT_RETRY_COUNT = 3
  8. DEFAULT_RETRY_TIMEOUT = 1
  9. DEFAULT_SCAN_TIMEOUT = 5
  10. class SwitchbotApiError(RuntimeError):
  11. """
  12. Raised when API call fails.
  13. This exception inherits from RuntimeError to avoid breaking existing code
  14. but will be changed to Exception in a future release.
  15. """
  16. class SwitchbotAuthenticationError(RuntimeError):
  17. """
  18. Raised when authentication fails.
  19. This exception inherits from RuntimeError to avoid breaking existing code
  20. but will be changed to Exception in a future release.
  21. """
  22. class SwitchbotAccountConnectionError(RuntimeError):
  23. """
  24. Raised when connection to Switchbot account fails.
  25. This exception inherits from RuntimeError to avoid breaking existing code
  26. but will be changed to Exception in a future release.
  27. """
  28. class SwitchbotModel(StrEnum):
  29. BOT = "WoHand"
  30. CURTAIN = "WoCurtain"
  31. HUMIDIFIER = "WoHumi"
  32. PLUG_MINI = "WoPlug"
  33. CONTACT_SENSOR = "WoContact"
  34. LIGHT_STRIP = "WoStrip"
  35. METER = "WoSensorTH"
  36. METER_PRO = "WoTHP"
  37. METER_PRO_C = "WoTHPc"
  38. IO_METER = "WoIOSensorTH"
  39. MOTION_SENSOR = "WoPresence"
  40. COLOR_BULB = "WoBulb"
  41. CEILING_LIGHT = "WoCeiling"
  42. LOCK = "WoLock"
  43. LOCK_PRO = "WoLockPro"
  44. BLIND_TILT = "WoBlindTilt"
  45. HUB2 = "WoHub2"
  46. LEAK = "Leak Detector"
  47. KEYPAD = "WoKeypad"
  48. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  49. RELAY_SWITCH_1 = "Relay Switch 1"
  50. REMOTE = "WoRemote"
  51. EVAPORATIVE_HUMIDIFIER = "Evaporative Humidifier"
  52. ROLLER_SHADE = "Roller Shade"
  53. HUBMINI_MATTER = "HubMini Matter"
  54. CIRCULATOR_FAN = "Circulator Fan"
  55. K20_VACUUM = "K20 Vacuum"
  56. S10_VACUUM = "S10 Vacuum"
  57. K10_VACUUM = "K10+ Vacuum"
  58. K10_PRO_VACUUM = "K10+ Pro Vacuum"
  59. K10_PRO_COMBO_VACUUM = "K10+ Pro Combo Vacuum"
  60. __all__ = [
  61. "DEFAULT_RETRY_COUNT",
  62. "DEFAULT_RETRY_TIMEOUT",
  63. "DEFAULT_SCAN_TIMEOUT",
  64. "FanMode",
  65. "LockStatus",
  66. "SwitchbotAccountConnectionError",
  67. "SwitchbotApiError",
  68. "SwitchbotAuthenticationError",
  69. "SwitchbotModel",
  70. ]