On going
This commit is contained in:
@@ -91,8 +91,6 @@ class Tevolve:
|
||||
|
||||
x = requests.post(url, headers=headers, data=data)
|
||||
|
||||
print(x)
|
||||
|
||||
if x.status_code == 200:
|
||||
Tevolve.token = x.json()["access_token"]
|
||||
else:
|
||||
@@ -113,16 +111,20 @@ class Tevolve:
|
||||
|
||||
|
||||
def get_devices(self):
|
||||
endpoint = "/devs/"+self.dev_id+"/mgr/nodes"
|
||||
try:
|
||||
endpoint = "/devs/"+self.dev_id+"/mgr/nodes"
|
||||
|
||||
header = {'content-type': 'application/json',
|
||||
"Authorization": "Bearer " + self.token_primary}
|
||||
header = {'content-type': 'application/json',
|
||||
"Authorization": "Bearer " + self.token_primary}
|
||||
|
||||
devices_request = requests.get(str(self.api_url + endpoint), headers=header).json()
|
||||
url = str(self.api_url + endpoint)
|
||||
devices_request = requests.get(str(self.api_url + endpoint), headers=header).json()
|
||||
|
||||
self.devices = devices_request
|
||||
self.devices = devices_request
|
||||
|
||||
except:
|
||||
raise
|
||||
|
||||
return self.devices
|
||||
|
||||
|
||||
|
||||
@@ -248,24 +250,29 @@ class Tevolve:
|
||||
return "heat"
|
||||
|
||||
|
||||
def get_status(self, heater_id):
|
||||
def get_status(self):
|
||||
result = []
|
||||
try:
|
||||
for index ,i in enumerate(self.devices["nodes"]):
|
||||
headers = {
|
||||
'host': 'api-tevolve.termoweb.net',
|
||||
'origin': 'https://tevolve.termoweb.net',
|
||||
'content-type': 'application/json',
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) '
|
||||
'Version/15.4 Safari/605.1.15',
|
||||
'authorization': 'Bearer ' + self.token_primary,
|
||||
'referer': 'https://tevolve.termoweb.net/',
|
||||
|
||||
headers = {
|
||||
'host': 'api-tevolve.termoweb.net',
|
||||
'origin': 'https://tevolve.termoweb.net',
|
||||
'content-type': 'application/json',
|
||||
'accept': 'application/json, text/plain, */*',
|
||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) '
|
||||
'Version/15.4 Safari/605.1.15',
|
||||
'authorization': 'Bearer ' + self.token_primary,
|
||||
'referer': 'https://tevolve.termoweb.net/',
|
||||
}
|
||||
url = "https://api-tevolve.termoweb.net/api/v2/devs/"+self.dev_id+"/htr/"+str(i["addr"])+"/status"
|
||||
|
||||
}
|
||||
url = "https://api-tevolve.termoweb.net/api/v2/devs/"+self.dev_id+"/htr/"+str(heater_id)+"/status"
|
||||
|
||||
response = requests.get(url, headers=headers)
|
||||
if response.status_code == 201 or response.status_code == 200:
|
||||
return response.json()
|
||||
response = requests.get(url, headers=headers)
|
||||
if response.status_code == 201 or response.status_code == 200:
|
||||
result.append({i["name"]: response.json()})
|
||||
except Exception as e:
|
||||
raise e
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def set_temperature(heater_id, set_temperature):
|
||||
|
||||
Reference in New Issue
Block a user