Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions switchbot/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from enum import Enum

class AirConditionerMode(Enum):
AUTO = 1
COOL = 2
DRY = 3
FAN = 4
HEAT = 5

class AirConditionerFanSpeed(Enum):
AUTO = 1
LOW = 2
MEDIUM = 3
HIGH = 4

class AirConditionerPowerState(Enum):
ON = "on"
OFF = "off"
8 changes: 8 additions & 0 deletions switchbot/remotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import humps

from switchbot.client import SwitchBotClient
from switchbot.enums import AirConditionerMode, AirConditionerFanSpeed, AirConditionerPowerState


class Remote:
Expand Down Expand Up @@ -62,6 +63,13 @@ def turn(self, state: str):
assert state in ("on", "off")
self.command(f"turn_{state}")

class AirConditioner(SupportedRemote):
remote_type_for = "Air Conditioner"

def set_all(self, temperature: int, mode: AirConditionerMode, fan_speed: AirConditionerFanSpeed, power_state: AirConditionerPowerState):
assert type(temperature) is int
self.command(action="setAll", parameter=f"{temperature},{mode.value},{fan_speed.value},{power_state.value}")


class OtherRemote(Remote):
remote_type_for = "Others"
Expand Down