mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-18 00:00:17 -07:00
Set on/off
This commit is contained in:
parent
c7173124cd
commit
d79f242c0f
12
wideq.py
12
wideq.py
@ -640,12 +640,24 @@ class ACDevice(object):
|
|||||||
def set_mode(self, mode):
|
def set_mode(self, mode):
|
||||||
"""Set the device's operating mode to an `OpMode` value.
|
"""Set the device's operating mode to an `OpMode` value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
mode_value = self.model.enum_value('OpMode', mode.value)
|
mode_value = self.model.enum_value('OpMode', mode.value)
|
||||||
self.client.session.set_device_controls(
|
self.client.session.set_device_controls(
|
||||||
self.device.id,
|
self.device.id,
|
||||||
{'OpMode': mode_value},
|
{'OpMode': mode_value},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def set_on(self, is_on):
|
||||||
|
"""Turn on or off the device (according to a boolean).
|
||||||
|
"""
|
||||||
|
|
||||||
|
op = ACOp.RIGHT_ON if is_on else ACOp.OFF
|
||||||
|
op_value = self.model.enum_value('Operation', op.value)
|
||||||
|
self.client.session.set_device_controls(
|
||||||
|
self.device.id,
|
||||||
|
{'Operation': op_value},
|
||||||
|
)
|
||||||
|
|
||||||
def monitor_start(self):
|
def monitor_start(self):
|
||||||
"""Start monitoring the device's status."""
|
"""Start monitoring the device's status."""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user