Commit e203d2df authored by Kristian Tan's avatar Kristian Tan

Displaying daily total on html

parent d3f4bdc3
...@@ -2,7 +2,7 @@ from flask import Flask, render_template ...@@ -2,7 +2,7 @@ from flask import Flask, render_template
import RPi.GPIO as GPIO import RPi.GPIO as GPIO
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
import os import os
from datetime import datetime from datetime import datetime, date
# from daily_usage import DailyUsage # from daily_usage import DailyUsage
app = Flask(__name__) app = Flask(__name__)
...@@ -102,7 +102,7 @@ def toggle_pin(change_pin): ...@@ -102,7 +102,7 @@ def toggle_pin(change_pin):
else: else:
message += " on." message += " on."
pins[change_pin]['on_time'] = datetime.now() pins[change_pin]['on_time'] = datetime.now()
pins[change_pin]['on_date'] = datetime.date.today() pins[change_pin]['on_date'] = date.today()
for pin in pins: for pin in pins:
pins[pin]['state'] = GPIO.input(pin) pins[pin]['state'] = GPIO.input(pin)
......
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