diff --git a/echo-master/echo_controller/led_strip.py b/echo-master/echo_controller/led_strip.py index 1cc7a81..54ebe28 100644 --- a/echo-master/echo_controller/led_strip.py +++ b/echo-master/echo_controller/led_strip.py @@ -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; diff --git a/echo-master/echo_controller/sensor.py b/echo-master/echo_controller/sensor.py index df4b4e5..fb8d859 100644 --- a/echo-master/echo_controller/sensor.py +++ b/echo-master/echo_controller/sensor.py @@ -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 = { diff --git a/echo-master/echo_controller/switch.py b/echo-master/echo_controller/switch.py index 3e6cec0..2d2dc76 100644 --- a/echo-master/echo_controller/switch.py +++ b/echo-master/echo_controller/switch.py @@ -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; diff --git a/echo-master/echo_db/database.py b/echo-master/echo_db/database.py index 92bf05d..4158643 100644 --- a/echo-master/echo_db/database.py +++ b/echo-master/echo_db/database.py @@ -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) \ No newline at end of file + database['MovementLogs'].create_index("timestamp", expireAfterSeconds=3600) + database['ClimateLogs'].create_index("timestamp", expireAfterSeconds=3600) + database['LightLogs'].create_index("timestamp", expireAfterSeconds=3600) \ No newline at end of file diff --git a/echo-master/echo_scheduler/scheduler.py b/echo-master/echo_scheduler/scheduler.py index 1a40ba6..e1dc3a5 100644 --- a/echo-master/echo_scheduler/scheduler.py +++ b/echo-master/echo_scheduler/scheduler.py @@ -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: