Update
This commit is contained in:
parent
d1bd548da5
commit
264f0d9aca
@ -19,8 +19,8 @@ class DataCollector:
|
|||||||
__API_KEY_PATH = "secrets/weather_api_key.txt"
|
__API_KEY_PATH = "secrets/weather_api_key.txt"
|
||||||
__CITY = "London"
|
__CITY = "London"
|
||||||
__API_ENDPOINT = "api.openweathermap.org/data/2.5/weather"
|
__API_ENDPOINT = "api.openweathermap.org/data/2.5/weather"
|
||||||
__NODE_T_ENDPOINT = "http://ss.maxhunt.design:3000/temp"
|
__NODE_T_ENDPOINT = "http://ss.maxhunt.design:3333/temp"
|
||||||
__NODE_H_ENDPOINT = "http://ss.maxhunt.design:3000/hmdt"
|
__NODE_H_ENDPOINT = "http://ss.maxhunt.design:3333/hmdt"
|
||||||
__TESTING = False
|
__TESTING = False
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -55,13 +55,13 @@ class DataCollector:
|
|||||||
# or push previous data
|
# or push previous data
|
||||||
return {"data": "TODO"}
|
return {"data": "TODO"}
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
rsp = api_get(self.__NODE_H_ENDPOINT)
|
rsp = api_get(self.__NODE_H_ENDPOINT)
|
||||||
rsp_json = rsp.json()
|
rsp_json = rsp.json()
|
||||||
local_hmdt = rsp_json.get('value', False)
|
local_hmdt = rsp_json.get('value', False)
|
||||||
except Exception:
|
# except Exception:
|
||||||
logging.error('Failed to get data from humidity node!!!')
|
# logging.error('Failed to get data from humidity node!!!')
|
||||||
local_hmdt = 0
|
# local_hmdt = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
rsp = api_get(self.__NODE_T_ENDPOINT)
|
rsp = api_get(self.__NODE_T_ENDPOINT)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user