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
45464383
Commit
45464383
authored
Nov 13, 2019
by
Kristian Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added remove device functionality
parent
43118966
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
app.py
app.py
+14
-1
main.html
templates/main.html
+1
-0
No files found.
app.py
View file @
45464383
...
@@ -183,6 +183,20 @@ def handle_new_device():
...
@@ -183,6 +183,20 @@ def handle_new_device():
return
render_template
(
'main.html'
,
**
template_data
)
return
render_template
(
'main.html'
,
**
template_data
)
@
app
.
route
(
'/delete/<delete_pin'
)
def
delete_pin
(
delete_pin
):
for
key
in
pins
:
if
key
==
delete_pin
:
pins
.
pop
(
delete_pin
)
template_data
=
{
'pins'
:
pins
,
'daily_total'
:
daily_total
,
'todays_cost'
:
todays_cost
,
'cost_per_kWh'
:
os
.
environ
[
'cost_per_kWh'
],
}
return
render_template
(
'main.html'
,
**
template_data
)
@
app
.
route
(
"/update_info/kWh"
)
@
app
.
route
(
"/update_info/kWh"
)
def
change_kWh
():
def
change_kWh
():
template_data
=
{
template_data
=
{
...
@@ -195,6 +209,5 @@ def change_kWh():
...
@@ -195,6 +209,5 @@ def change_kWh():
return
render_template
(
'main.html'
,
**
template_data
)
return
render_template
(
'main.html'
,
**
template_data
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
app
.
run
(
host
=
'0.0.0.0'
,
port
=
8090
)
app
.
run
(
host
=
'0.0.0.0'
,
port
=
8090
)
templates/main.html
View file @
45464383
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
(
<a
href=
"/toggle/{{pin}}"
>
turn off
</a>
)
(
<a
href=
"/toggle/{{pin}}"
>
turn off
</a>
)
{% else %}
{% else %}
(
<a
href=
"/toggle/{{pin}}"
>
turn on
</a>
)
(
<a
href=
"/toggle/{{pin}}"
>
turn on
</a>
)
(
<a
href=
"/remove/{{pin}}"
>
remove
</a>
)
</p>
</p>
{% endif %}
{% endif %}
{% endif %}
{% endif %}
...
...
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