-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.py
35 lines (30 loc) · 1.13 KB
/
controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import asyncio
from api import AirTouch
"""
Creates a new Air Conditioner Controller object
"""
class Controller:
def __init__(self, host):
"""Constructor for the Air Conditioner Controller object"""
self.host = host
self.api = AirTouch(host)
asyncio.run(self.api.UpdateInfo())
def get_info(self):
"""Update information using API"""
asyncio.run(self.api.UpdateInfo())
def get_temperature(self) -> None:
"""Returns the current temperature(s) for room(s)"""
#TODO Add API to return global temperature
pass
def set_mode_ac(self, ac, mode):
"""Sets the AC mode i.e. ['Cool', 'Fan', 'Dry', 'Heat', 'Auto']"""
asyncio.run(self.api.SetCoolingModeForAc(ac, mode))
def set_fan_ac(self, ac, fan):
"""Sets the AC fan i.e. ['Auto', 'Low', 'Medium', 'High']"""
asyncio.run(self.api.SetFanSpeedForAc(ac, fan))
def set_power_ac(self, ac, power):
"""Toggles the AC power on=1 or off=0"""
if (power):
asyncio.run(self.api.TurnAcOn(ac))
else:
asyncio.run(self.api.TurnAcOff(ac))