1
0

const.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. """Library to handle connection with Switchbot."""
  2. from __future__ import annotations
  3. from enum import Enum
  4. DEFAULT_RETRY_COUNT = 3
  5. DEFAULT_RETRY_TIMEOUT = 1
  6. DEFAULT_SCAN_TIMEOUT = 5
  7. from .enum import StrEnum
  8. class SwitchbotAuthenticationError(RuntimeError):
  9. """Raised when authentication fails.
  10. This exception inherits from RuntimeError to avoid breaking existing code
  11. but will be changed to Exception in a future release.
  12. """
  13. class SwitchbotAccountConnectionError(RuntimeError):
  14. """Raised when connection to Switchbot account fails.
  15. This exception inherits from RuntimeError to avoid breaking existing code
  16. but will be changed to Exception in a future release.
  17. """
  18. class SwitchbotModel(StrEnum):
  19. BOT = "WoHand"
  20. CURTAIN = "WoCurtain"
  21. HUMIDIFIER = "WoHumi"
  22. PLUG_MINI = "WoPlug"
  23. CONTACT_SENSOR = "WoContact"
  24. LIGHT_STRIP = "WoStrip"
  25. METER = "WoSensorTH"
  26. IO_METER = "WoIOSensorTH"
  27. MOTION_SENSOR = "WoPresence"
  28. COLOR_BULB = "WoBulb"
  29. CEILING_LIGHT = "WoCeiling"
  30. LOCK = "WoLock"
  31. BLIND_TILT = "WoBlindTilt"
  32. class LockStatus(Enum):
  33. LOCKED = 0
  34. UNLOCKED = 1
  35. LOCKING = 2
  36. UNLOCKING = 3
  37. LOCKING_STOP = 4 # LOCKING_BLOCKED
  38. UNLOCKING_STOP = 5 # UNLOCKING_BLOCKED
  39. NOT_FULLY_LOCKED = 6 # LATCH_LOCKED - Only EU lock type