Commit bc2d8d3d authored by Kristian Tan's avatar Kristian Tan

meh

parent 4067fc51
......@@ -4,6 +4,7 @@ from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import asc, desc
import os
from datetime import datetime, date, timedelta
from services import daily_usage_service
# from daily_usage import DailyUsage
app = Flask(__name__)
......@@ -16,6 +17,8 @@ GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
db = SQLAlchemy(app)
os.environ['cost_per_kWh'] = '0.1622'
# TODO: Move this into daily_usage class file
class DailyUsage(db.Model):
......@@ -32,10 +35,6 @@ class DailyUsage(db.Model):
def __repr__(self):
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():
latest_entry = DailyUsage.query.order_by(desc(DailyUsage.date)).first()
......@@ -101,7 +100,7 @@ db.create_all()
daily_total = get_todays_usage()
todays_cost = get_todays_cost()
print(get_todays_usage())
print(daily_usage_service.DailyUsageService.get_todays_usage())
# print(daily_usage_service.DailyUsageService.get_todays_usage())
print(get_todays_cost())
# 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