Commit d9cd0bfb authored by Kristian Tan's avatar Kristian Tan

Added placeholder pins

parent 825ed891
...@@ -79,7 +79,9 @@ todays_cost = get_todays_cost() ...@@ -79,7 +79,9 @@ todays_cost = get_todays_cost()
# Create dictionary to store pin info # Create dictionary to store pin info
pins = { pins = {
25: {'name': 'Light', 'state': GPIO.LOW, 'on_time': None, 'on_date': None, 'Wattage': 15} 25: {'name': 'Light', 'state': GPIO.LOW, 'on_time': None, 'on_date': None, 'Wattage': 15},
28: {'name': None, 'state': GPIO.LOW, 'on_time': None, 'on_date': None, 'Wattage': 15},
27: {'name': None, 'state': GPIO.LOW, 'on_time': None, 'on_date': None, 'Wattage': 15}
} }
...@@ -160,6 +162,7 @@ def add_new_device(): ...@@ -160,6 +162,7 @@ def add_new_device():
} }
return render_template('main.html', **template_data) return render_template('main.html', **template_data)
@app.route('/handle_new_device', methods=['POST']) @app.route('/handle_new_device', methods=['POST'])
def handle_new_device(): def handle_new_device():
new_name = request.form['new_device_name'] new_name = request.form['new_device_name']
......
...@@ -14,14 +14,16 @@ ...@@ -14,14 +14,16 @@
<h3 class="device_list_title">Device Listing and Status</h3> <h3 class="device_list_title">Device Listing and Status</h3>
{% for pin in pins %} {% for pin in pins %}
<p>{{ pins[pin].name }} : {% if pin.name != None %}
<p>
{{ pins[pin].name }} :
{% if pins[pin].state == true %} {% if pins[pin].state == true %}
(<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>)
{% endif %}
</p> </p>
{% endif %}
{% endif %}
<p><a href="/devices/add_device">Add device</a></p> <p><a href="/devices/add_device">Add device</a></p>
{% endfor %} {% endfor %}
......
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