1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- """Library to handle connection with Switchbot."""
- from __future__ import annotations
- from enum import Enum
- from .enum import StrEnum
- DEFAULT_RETRY_COUNT = 3
- DEFAULT_RETRY_TIMEOUT = 1
- DEFAULT_SCAN_TIMEOUT = 5
- class SwitchbotApiError(RuntimeError):
- """Raised when API call fails.
- This exception inherits from RuntimeError to avoid breaking existing code
- but will be changed to Exception in a future release.
- """
- class SwitchbotAuthenticationError(RuntimeError):
- """Raised when authentication fails.
- This exception inherits from RuntimeError to avoid breaking existing code
- but will be changed to Exception in a future release.
- """
- class SwitchbotAccountConnectionError(RuntimeError):
- """Raised when connection to Switchbot account fails.
- This exception inherits from RuntimeError to avoid breaking existing code
- but will be changed to Exception in a future release.
- """
- class SwitchbotModel(StrEnum):
- BOT = "WoHand"
- CURTAIN = "WoCurtain"
- HUMIDIFIER = "WoHumi"
- PLUG_MINI = "WoPlug"
- CONTACT_SENSOR = "WoContact"
- LIGHT_STRIP = "WoStrip"
- METER = "WoSensorTH"
- METER_PRO = "WoTHP"
- METER_PRO_C = "WoTHPc"
- IO_METER = "WoIOSensorTH"
- MOTION_SENSOR = "WoPresence"
- COLOR_BULB = "WoBulb"
- CEILING_LIGHT = "WoCeiling"
- LOCK = "WoLock"
- LOCK_PRO = "WoLockPro"
- BLIND_TILT = "WoBlindTilt"
- HUB2 = "WoHub2"
- KEYPAD = "WoKeypad"
- RELAY_SWITCH_1PM = "Relay Switch 1PM"
- RELAY_SWITCH_1 = "Relay Switch 1"
- class LockStatus(Enum):
- LOCKED = 0
- UNLOCKED = 1
- LOCKING = 2
- UNLOCKING = 3
- LOCKING_STOP = 4 # LOCKING_BLOCKED
- UNLOCKING_STOP = 5 # UNLOCKING_BLOCKED
- NOT_FULLY_LOCKED = 6 # LATCH_LOCKED - Only EU lock type
|