1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-21 09:30:13 -07:00

Merge pull request #39 from fabiomsouto/master

Add support for swing configuration
This commit is contained in:
Fábio Souto 2019-07-23 19:25:35 +01:00 committed by GitHub
commit 4d4410ad39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 1 deletions

View File

@ -4,4 +4,4 @@ from .core import * # noqa
from .client import * # noqa
from .ac import * # noqa
__version__ = '1.0.3'
__version__ = '1.1.0'

View File

@ -4,6 +4,43 @@ import enum
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."""
@ -131,6 +168,20 @@ class ACDevice(Device):
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.
"""