__init__.py 2.4 KB

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