1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-17 15:50:10 -07:00

Set on/off

This commit is contained in:
Adrian Sampson 2018-02-18 11:28:57 -05:00
parent c7173124cd
commit d79f242c0f

View File

@ -640,12 +640,24 @@ class ACDevice(object):
def set_mode(self, mode):
"""Set the device's operating mode to an `OpMode` value.
"""
mode_value = self.model.enum_value('OpMode', mode.value)
self.client.session.set_device_controls(
self.device.id,
{'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):
"""Start monitoring the device's status."""