This commit is contained in:
2020-07-07 19:04:43 +02:00
parent e14097c329
commit 22385cdef3
5 changed files with 10 additions and 10 deletions

View File

@@ -92,7 +92,7 @@ class LEDStrip:
return
# Check if light levels are low enough to turn on light
collectionLight = EchoDB.EchoDB.database['LightLog']
collectionLight = EchoDB.EchoDB.database['LightLogs']
data = collectionLight.find().sort([('timestamp', -1)]).limit(1)
if data[0]['light_amount'] > 20:
return;

View File

@@ -21,7 +21,7 @@ class Sensor:
return {'status': 'success', 'message': actionData['message']}, 200
if action == "get_climate_data":
collection = EchoDB.EchoDB.database['ClimateLogs']
collection = EchoDB.EchoDB.database['ClimateLogss']
data = collection.find().sort([('timestamp', -1)]).limit(1)
data_json = json.loads(json_util.dumps(data))
return {'status': 'success', 'message': actionData['message'], 'data': data_json}, 200
@@ -35,7 +35,7 @@ class Sensor:
return {'status': 'success', 'message': actionData['message']}, 200
if action == "get_light_data":
collection = EchoDB.EchoDB.database['LightLog']
collection = EchoDB.EchoDB.database['LightLogs']
data = collection.find().sort([('timestamp', -1)]).limit(1)
data_json = json.loads(json_util.dumps(data))
return {'status': 'success', 'message': actionData['message'], 'data': data_json}, 200
@@ -57,7 +57,7 @@ class Sensor:
#
if action == 'climate_data':
collection = EchoDB.EchoDB.database['ClimateLogs']
collection = EchoDB.EchoDB.database['ClimateLogss']
climate_data = data[2].split(',')
logData = {
@@ -74,7 +74,7 @@ class Sensor:
#
if action == 'light_data':
collection = EchoDB.EchoDB.database['LightLog']
collection = EchoDB.EchoDB.database['LightLogs']
lightAmount = data[2]
logData = {

View File

@@ -52,7 +52,7 @@ class Switch:
return
# Check if light levels are low enough to turn on light
collectionLight = EchoDB.EchoDB.database['LightLog']
collectionLight = EchoDB.EchoDB.database['LightLogs']
data = collectionLight.find().sort([('timestamp', -1)]).limit(1)
if data[0]['light_amount'] > 250:
return;