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

Example of higher-level monitoring

This commit is contained in:
Adrian Sampson 2018-02-18 11:00:27 -05:00
parent 5e258c65a6
commit 315dbd73e1
2 changed files with 23 additions and 0 deletions

View File

@ -50,6 +50,26 @@ def example_command(client, args):
except KeyboardInterrupt:
pass
elif args[0] == 'ac-mon':
device_id = args[1]
ac = wideq.ACDevice(client, client.get_device(device_id))
try:
ac.monitor_start()
while True:
time.sleep(1)
state = ac.poll()
if state:
print(
'cur {0.temp_cur_f}°F; cfg {0.temp_cfg_f}°F'
.format(state)
)
except KeyboardInterrupt:
pass
finally:
ac.monitor_stop()
elif args[0] == 'set-temp':
temp = args[1]
device_id = args[2]

View File

@ -625,6 +625,9 @@ class ACDevice(object):
class ACStatus(object):
"""Higher-level information about an AC device's current status.
"""
def __init__(self, ac, data):
self.ac = ac
self.data = data