This commit is contained in:
Max 2020-12-24 15:48:44 +00:00
parent d1bd548da5
commit 264f0d9aca

View File

@ -19,8 +19,8 @@ class DataCollector:
__API_KEY_PATH = "secrets/weather_api_key.txt"
__CITY = "London"
__API_ENDPOINT = "api.openweathermap.org/data/2.5/weather"
__NODE_T_ENDPOINT = "http://ss.maxhunt.design:3000/temp"
__NODE_H_ENDPOINT = "http://ss.maxhunt.design:3000/hmdt"
__NODE_T_ENDPOINT = "http://ss.maxhunt.design:3333/temp"
__NODE_H_ENDPOINT = "http://ss.maxhunt.design:3333/hmdt"
__TESTING = False
def __init__(self):
@ -55,13 +55,13 @@ class DataCollector:
# or push previous data
return {"data": "TODO"}
try:
rsp = api_get(self.__NODE_H_ENDPOINT)
rsp_json = rsp.json()
local_hmdt = rsp_json.get('value', False)
except Exception:
logging.error('Failed to get data from humidity node!!!')
local_hmdt = 0
# try:
rsp = api_get(self.__NODE_H_ENDPOINT)
rsp_json = rsp.json()
local_hmdt = rsp_json.get('value', False)
# except Exception:
# logging.error('Failed to get data from humidity node!!!')
# local_hmdt = 0
try:
rsp = api_get(self.__NODE_T_ENDPOINT)