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
22868eaf
Commit
22868eaf
authored
Nov 13, 2019
by
Kristian Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
List all records
parent
cc750257
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
app.py
app.py
+13
-9
No files found.
app.py
View file @
22868eaf
...
@@ -99,15 +99,9 @@ def main():
...
@@ -99,15 +99,9 @@ def main():
for
pin
in
pins
:
for
pin
in
pins
:
pins
[
pin
][
'state'
]
=
GPIO
.
input
(
pin
)
pins
[
pin
][
'state'
]
=
GPIO
.
input
(
pin
)
# Set the template data for the HTML template
records
=
DailyUsage
.
query
.
all
()
template_data
=
{
for
record
in
records
:
'pins'
:
pins
,
print
(
record
)
'daily_total'
:
daily_total
,
'todays_cost'
:
todays_cost
,
'cost_per_kWh'
:
os
.
environ
[
'cost_per_kWh'
],
'display_new_device_form'
:
False
,
'display_change_kWh'
:
False
}
labels
=
[
labels
=
[
'JAN'
,
'FEB'
,
'MAR'
,
'APR'
,
'JAN'
,
'FEB'
,
'MAR'
,
'APR'
,
...
@@ -121,6 +115,16 @@ def main():
...
@@ -121,6 +115,16 @@ def main():
4349.29
,
6458.30
,
9907
,
16297
4349.29
,
6458.30
,
9907
,
16297
]
]
# Set the template data for the HTML template
template_data
=
{
'pins'
:
pins
,
'daily_total'
:
daily_total
,
'todays_cost'
:
todays_cost
,
'cost_per_kWh'
:
os
.
environ
[
'cost_per_kWh'
],
'display_new_device_form'
:
False
,
'display_change_kWh'
:
False
}
return
render_template
(
'main.html'
,
**
template_data
,
labels
=
labels
,
values
=
values
)
return
render_template
(
'main.html'
,
**
template_data
,
labels
=
labels
,
values
=
values
)
...
...
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