Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
IoTSmartMeter
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kristian.tan
IoTSmartMeter
Commits
e68b22b1
Commit
e68b22b1
authored
Nov 13, 2019
by
Kristian Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
6a14b698
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
12 deletions
+2
-12
app.py
app.py
+2
-12
No files found.
app.py
View file @
e68b22b1
...
...
@@ -114,18 +114,6 @@ for pin in pins:
labels
,
values
,
max
=
generate_graph_data
()
# Create data for chart
# count = 0
# 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
# count += 1
# if count >= 7:
# break
@
app
.
route
(
"/"
)
def
main
():
# For each pin, read the pin state and store it in the pins dictionary:
...
...
@@ -158,6 +146,7 @@ def toggle_pin(change_pin):
if
GPIO
.
input
(
change_pin
)
==
0
:
if
pins
[
change_pin
][
'on_time'
]
is
not
None
:
create_entry
(
change_pin
)
else
:
pins
[
change_pin
][
'on_time'
]
=
datetime
.
now
()
pins
[
change_pin
][
'on_date'
]
=
date
.
today
()
...
...
@@ -165,6 +154,7 @@ def toggle_pin(change_pin):
for
pin
in
pins
:
pins
[
pin
][
'state'
]
=
GPIO
.
input
(
pin
)
labels
,
values
,
max
=
generate_graph_data
()
template_data
=
{
'pins'
:
pins
,
'daily_total'
:
get_todays_usage
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment