mirror of
https://github.com/no2chem/wideq.git
synced 2025-05-16 15:20:09 -07:00
Example of higher-level monitoring
This commit is contained in:
parent
5e258c65a6
commit
315dbd73e1
20
example.py
20
example.py
@ -50,6 +50,26 @@ def example_command(client, args):
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
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':
|
elif args[0] == 'set-temp':
|
||||||
temp = args[1]
|
temp = args[1]
|
||||||
device_id = args[2]
|
device_id = args[2]
|
||||||
|
3
wideq.py
3
wideq.py
@ -625,6 +625,9 @@ class ACDevice(object):
|
|||||||
|
|
||||||
|
|
||||||
class ACStatus(object):
|
class ACStatus(object):
|
||||||
|
"""Higher-level information about an AC device's current status.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, ac, data):
|
def __init__(self, ac, data):
|
||||||
self.ac = ac
|
self.ac = ac
|
||||||
self.data = data
|
self.data = data
|
||||||
|
Loading…
x
Reference in New Issue
Block a user