Commit bc2d8d3d authored by Kristian Tan's avatar Kristian Tan

meh

parent 4067fc51
...@@ -4,6 +4,7 @@ from flask_sqlalchemy import SQLAlchemy ...@@ -4,6 +4,7 @@ from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import asc, desc from sqlalchemy import asc, desc
import os import os
from datetime import datetime, date, timedelta from datetime import datetime, date, timedelta
from services import daily_usage_service
# from daily_usage import DailyUsage # from daily_usage import DailyUsage
app = Flask(__name__) app = Flask(__name__)
...@@ -16,6 +17,8 @@ GPIO.setmode(GPIO.BCM) ...@@ -16,6 +17,8 @@ GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False) GPIO.setwarnings(False)
db = SQLAlchemy(app) db = SQLAlchemy(app)
os.environ['cost_per_kWh'] = '0.1622'
# TODO: Move this into daily_usage class file # TODO: Move this into daily_usage class file
class DailyUsage(db.Model): class DailyUsage(db.Model):
...@@ -32,10 +35,6 @@ class DailyUsage(db.Model): ...@@ -32,10 +35,6 @@ class DailyUsage(db.Model):
def __repr__(self): def __repr__(self):
return '<DailyUsage %r, %r, %r>' % (self.id, self.date, self.kwhUsed) return '<DailyUsage %r, %r, %r>' % (self.id, self.date, self.kwhUsed)
from services import daily_usage_service
os.environ['cost_per_kWh'] = '0.1622'
def get_todays_usage(): def get_todays_usage():
latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first() latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first()
...@@ -101,7 +100,7 @@ db.create_all() ...@@ -101,7 +100,7 @@ db.create_all()
daily_total = get_todays_usage() daily_total = get_todays_usage()
todays_cost = get_todays_cost() todays_cost = get_todays_cost()
print(get_todays_usage()) print(get_todays_usage())
print(daily_usage_service.DailyUsageService.get_todays_usage()) # print(daily_usage_service.DailyUsageService.get_todays_usage())
print(get_todays_cost()) print(get_todays_cost())
# Create dictionary to store pin info # Create dictionary to store pin info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment