1
0

__init__.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. """Switchbot Device Consts Library."""
  2. from __future__ import annotations
  3. from ..enum import StrEnum
  4. # Preserve old LockStatus export for backwards compatibility
  5. from .lock import LockStatus as LockStatus
  6. DEFAULT_RETRY_COUNT = 3
  7. DEFAULT_RETRY_TIMEOUT = 1
  8. DEFAULT_SCAN_TIMEOUT = 5
  9. class SwitchbotApiError(RuntimeError):
  10. """
  11. Raised when API call fails.
  12. This exception inherits from RuntimeError to avoid breaking existing code
  13. but will be changed to Exception in a future release.
  14. """
  15. class SwitchbotAuthenticationError(RuntimeError):
  16. """
  17. Raised when authentication fails.
  18. This exception inherits from RuntimeError to avoid breaking existing code
  19. but will be changed to Exception in a future release.
  20. """
  21. class SwitchbotAccountConnectionError(RuntimeError):
  22. """
  23. Raised when connection to Switchbot account fails.
  24. This exception inherits from RuntimeError to avoid breaking existing code
  25. but will be changed to Exception in a future release.
  26. """
  27. class SwitchbotModel(StrEnum):
  28. BOT = "WoHand"
  29. CURTAIN = "WoCurtain"
  30. HUMIDIFIER = "WoHumi"
  31. PLUG_MINI = "WoPlug"
  32. CONTACT_SENSOR = "WoContact"
  33. LIGHT_STRIP = "WoStrip"
  34. METER = "WoSensorTH"
  35. METER_PRO = "WoTHP"
  36. METER_PRO_C = "WoTHPc"
  37. IO_METER = "WoIOSensorTH"
  38. MOTION_SENSOR = "WoPresence"
  39. COLOR_BULB = "WoBulb"
  40. CEILING_LIGHT = "WoCeiling"
  41. LOCK = "WoLock"
  42. LOCK_PRO = "WoLockPro"
  43. BLIND_TILT = "WoBlindTilt"
  44. HUB2 = "WoHub2"
  45. LEAK = "Leak Detector"
  46. KEYPAD = "WoKeypad"
  47. RELAY_SWITCH_1PM = "Relay Switch 1PM"
  48. RELAY_SWITCH_1 = "Relay Switch 1"
  49. REMOTE = "WoRemote"