Commit 9397f4ca authored by Kristian Tan's avatar Kristian Tan

Show new device

parent 259b6437
...@@ -80,8 +80,8 @@ todays_cost = get_todays_cost() ...@@ -80,8 +80,8 @@ 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}, 28: {'name': None, 'state': GPIO.LOW, 'on_time': None, 'on_date': None, 'Wattage': 0},
27: {'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': 0}
} }
...@@ -167,8 +167,12 @@ def add_new_device(): ...@@ -167,8 +167,12 @@ def add_new_device():
def handle_new_device(): def handle_new_device():
new_name = request.form['new_device_name'] new_name = request.form['new_device_name']
new_wattage = request.form['new_device_wattage'] new_wattage = request.form['new_device_wattage']
print(new_name) for key in dict:
print(new_wattage) if pins[key].name != None:
pins[key]['name'] = new_name
pins[key]['wattage'] = new_wattage
break
template_data = { template_data = {
'pins': pins, 'pins': pins,
'daily_total': daily_total, 'daily_total': daily_total,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<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 %}
{% if pins[pin].name != 'None' %} {% if pins[pin].name != None %}
<p> <p>
{{ pins[pin].name }} : {{ pins[pin].name }} :
{% if pins[pin].state == true %} {% if pins[pin].state == true %}
......
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