fixes
This commit is contained in:
parent
e14097c329
commit
22385cdef3
@ -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;
|
||||
|
@ -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 = {
|
||||
|
@ -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;
|
||||
|
@ -17,6 +17,6 @@ class EchoDB:
|
||||
database = mongo_client['Echo']
|
||||
|
||||
# Create Indexes
|
||||
database['MovementLog'].create_index("timestamp", expireAfterSeconds=10)
|
||||
database['ClimateLog'].create_index("timestamp", expireAfterSeconds=10)
|
||||
database['LightLog'].create_index("timestamp", expireAfterSeconds=10)
|
||||
database['MovementLogs'].create_index("timestamp", expireAfterSeconds=3600)
|
||||
database['ClimateLogs'].create_index("timestamp", expireAfterSeconds=3600)
|
||||
database['LightLogs'].create_index("timestamp", expireAfterSeconds=3600)
|
@ -26,7 +26,7 @@ class EchoScheduler:
|
||||
schedule.every(1).minute.do(EchoScheduler.checkAutomaticShutdown)
|
||||
schedule.every(1).minute.do(EchoScheduler.checkAutomaticBlinds)
|
||||
|
||||
# collection_delete = EchoDB.EchoDB.database['ClimateLogs']
|
||||
# collection_delete = EchoDB.EchoDB.database['ClimateLogss']
|
||||
# collection_delete.remove({})
|
||||
|
||||
while True:
|
||||
|
Loading…
x
Reference in New Issue
Block a user