Commit b9e3aa7b authored by Kristian Tan's avatar Kristian Tan

Rerouting

parent 396fc6a0
......@@ -136,7 +136,7 @@ def create_entry(change_pin):
pins[change_pin]['on_date'] = None
@app.route('/handle_data', methods=['POST'])
@app.route('/handle_data/update_kWh', methods=['POST'])
def handle_data():
new_price = request.form['kWhprice']
os.environ['cost_per_kWh'] = str(new_price)
......@@ -147,6 +147,9 @@ def handle_data():
}
return render_template('main.html', **template_data)
@app.route("/devices/add_device")
def add_new_device():
pass
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8090)
......@@ -13,15 +13,20 @@
<div class="device_list">
<h3 class="device_list_title">Device Listing and Status</h3>
{% for pin in pins %}
<p>{{ pins[pin].name }} :
{% if pins[pin].state == true %}
{% for pin in pins %}
<p>{{ pins[pin].name }} :
{% if pins[pin].state == true %}
(<a href="/toggle/{{pin}}">turn off</a>)
{% else %}
(<a href="/toggle/{{pin}}">turn on</a>)
{% endif %}
</p>
{% endfor %}
{% else %}
(<a href="/toggle/{{pin}}">turn on</a>)
{% endif %}
</p>
<p><a href="/devices/add_device">Add device</a></p>
{% endfor %}
<p></p>
</div>
<div class="smart_meter">
......@@ -42,7 +47,7 @@
</div>
</div>
<div class="inputs">
<form action="{{ url_for('handle_data') }}" method="post">
<form action="{{ url_for('handle_data/update_kWh') }}" method="post">
Change cost per kWh: <input type="text" name="kWhprice">
<input type="submit">
</form>
......
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