Commit d2aea06a authored by Kristian Tan's avatar Kristian Tan

convert seconds to kwh

parent d9730bd0
...@@ -115,13 +115,6 @@ def create_entry(change_pin): ...@@ -115,13 +115,6 @@ def create_entry(change_pin):
elapsed = int((datetime.now() - start_time).total_seconds()) elapsed = int((datetime.now() - start_time).total_seconds())
start_date = pins[change_pin]['on_date'] start_date = pins[change_pin]['on_date']
kwh = pins[change_pin]['Wattage'] * (elapsed / 3600) / 1000 kwh = pins[change_pin]['Wattage'] * (elapsed / 3600) / 1000
a = elapsed / 3600
print(a)
b = pins[change_pin]['Wattage'] * a
print(b)
c = b / 1000
print(c)
kwh = c
# If there is already an entry for today, update on time # If there is already an entry for today, update on time
# if latest_entry: # if latest_entry:
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
{% endfor %} {% endfor %}
</p> </p>
{# Implement some way to display "No devices" message if none are in use#} {# Implement some way to display "No devices" message if none are in use#}
<p> Total energy used today: {{ daily_total }} kWh of energy.</p> <p> Total energy used today: {{ daily_total }} kWh.</p>
</div> </div>
</div> </div>
</div> </div>
......
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