Skip to content

Commit

Permalink
Merge pull request #39 from fabiomsouto/master
Browse files Browse the repository at this point in the history
Add support for swing configuration
  • Loading branch information
fabiomsouto authored Jul 23, 2019
2 parents ad99849 + 15855f0 commit 4d4410a
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion wideq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .client import * # noqa
from .ac import * # noqa

__version__ = '1.0.3'
__version__ = '1.1.0'
51 changes: 51 additions & 0 deletions wideq/ac.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@

from .client import Device

class ACVSwingMode(enum.Enum):
"""The vertical swing mode for an AC/HVAC device.
Blades are numbered vertically from 1 (topmost)
to 6.
All is 100.
"""
OFF = "@OFF"
ONE = "@1"
TWO = "@2"
THREE = "@3"
FOUR = "@4"
FIVE = "@5"
SIX = "@6"
ALL = "@100"

class ACHSwingMode(enum.Enum):
"""The horizontal swing mode for an AC/HVAC device.
Blades are numbered horizontally from 1 (leftmost)
to 5.
Left half goes from 1-3, and right half goes from
3-5.
All is 100.
"""
OFF = "@OFF"
ONE = "@1"
TWO = "@2"
THREE = "@3"
FOUR = "@4"
FIVE = "@5"
LEFT_HALF = "@13"
RIGHT_HALF = "@35"
ALL = "@100"

class ACMode(enum.Enum):
"""The operation mode for an AC/HVAC device."""
Expand Down Expand Up @@ -131,6 +168,20 @@ def set_fan_speed(self, speed):
speed_value = self.model.enum_value('WindStrength', speed.value)
self._set_control('WindStrength', speed_value)

def set_horz_swing(self, swing):
"""Set the horizontal swing to a value from the `ACHSwingMode` enum.
"""

swing_value = self.model.enum_value('WDirHStep', swing.value)
self._set_control('WDirHStep', swing_value)

def set_vert_swing(self, swing):
"""Set the vertical swing to a value from the `ACVSwingMode` enum.
"""

swing_value = self.model.enum_value('WDirVStep', swing.value)
self._set_control('WDirVStep', swing_value)

def set_mode(self, mode):
"""Set the device's operating mode to an `OpMode` value.
"""
Expand Down

0 comments on commit 4d4410a

Please sign in to comment.