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:
parent
5e258c65a6
commit
315dbd73e1
20
example.py
20
example.py
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user