Commit 217aa71b authored by Kristian Tan's avatar Kristian Tan

Fix not tracking usage

parent 8b089978
......@@ -95,23 +95,23 @@ for pin in pins:
GPIO.output(pin, GPIO.LOW)
@app.route("/")
def main():
# For each pin, read the pin state and store it in the pins dictionary:
for pin in pins:
pins[pin]['state'] = GPIO.input(pin)
labels = []
values = []
max = 0
labels = []
values = []
max = 0
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
for record in records:
records = DailyUsage.query.order_by(asc(DailyUsage.date)).all()
for record in records:
labels.append(date(record.date.year, record.date.month, record.date.day))
values.append(record.kwhUsed)
if record.kwhUsed > max:
max = record.kwhUsed
@app.route("/")
def main():
# For each pin, read the pin state and store it in the pins dictionary:
for pin in pins:
pins[pin]['state'] = GPIO.input(pin)
template_data = {
'pins': pins,
'daily_total': daily_total,
......
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