const.py 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 SwitchbotModel(StrEnum):
  14. BOT = "WoHand"
  15. CURTAIN = "WoCurtain"
  16. HUMIDIFIER = "WoHumi"
  17. PLUG_MINI = "WoPlug"
  18. CONTACT_SENSOR = "WoContact"
  19. LIGHT_STRIP = "WoStrip"
  20. METER = "WoSensorTH"
  21. MOTION_SENSOR = "WoPresence"
  22. COLOR_BULB = "WoBulb"
  23. CEILING_LIGHT = "WoCeiling"
  24. LOCK = "WoLock"
  25. class LockStatus(Enum):
  26. LOCKED = 0
  27. UNLOCKED = 1
  28. LOCKING = 2
  29. UNLOCKING = 3
  30. LOCKING_STOP = 4 # LOCKING_BLOCKED
  31. UNLOCKING_STOP = 5 # UNLOCKING_BLOCKED
  32. NOT_FULLY_LOCKED = 6 # LATCH_LOCKED - Only EU lock type