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
095a5350
Commit
095a5350
authored
Nov 13, 2019
by
Kristian Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added input box for kWh ptice
parent
12ab271f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
app.py
app.py
+12
-1
main.html
templates/main.html
+4
-0
No files found.
app.py
View file @
095a5350
from
flask
import
Flask
,
render_template
from
flask
import
Flask
,
render_template
,
request
import
RPi.GPIO
as
GPIO
from
flask_sqlalchemy
import
SQLAlchemy
...
...
@@ -135,6 +135,17 @@ def create_entry(change_pin):
pins
[
change_pin
][
'on_time'
]
=
None
pins
[
change_pin
][
'on_date'
]
=
None
@
app
.
route
(
'/handle_data'
,
methods
=
[
'POST'
])
def
handle_data
():
projectpath
=
request
.
form
[
'kWhprice'
]
print
(
projectpath
)
template_data
=
{
'pins'
:
pins
,
'daily_total'
:
daily_total
,
'todays_cost'
:
todays_cost
}
return
render_template
(
'main.html'
,
**
template_data
)
if
__name__
==
'__main__'
:
app
.
run
(
host
=
'0.0.0.0'
,
port
=
8090
)
templates/main.html
View file @
095a5350
...
...
@@ -10,6 +10,10 @@
<body>
<div
class=
"container"
>
<form
action=
"{{ url_for('handle_data') }}"
method=
"post"
>
<input
type=
"text"
name=
"kWhprice"
>
<input
type=
"submit"
>
</form>
<div
class=
"device_list"
>
<h3
class=
"device_list_title"
>
Device Listing and Status
</h3>
...
...
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