Commit 87f9bcd5 authored by Kristian Tan's avatar Kristian Tan

Haandle no on time

parent 3e377690
...@@ -74,6 +74,7 @@ def toggle_pin(change_pin): ...@@ -74,6 +74,7 @@ def toggle_pin(change_pin):
message = "Turned " + device_name message = "Turned " + device_name
if GPIO.input(change_pin) == 0: if GPIO.input(change_pin) == 0:
message += " off." message += " off."
if pins[change_pin]['on_time'] is not None:
uptime = datetime.now() - pins[change_pin]['on_time'] uptime = datetime.now() - pins[change_pin]['on_time']
uptime = datetime.strptime(uptime, '%b %d %Y %I:%M%p') uptime = datetime.strptime(uptime, '%b %d %Y %I:%M%p')
date = datetime.strptime(pins[change_pin]['on_time'], '%b %d %Y %I:%M%p') date = datetime.strptime(pins[change_pin]['on_time'], '%b %d %Y %I:%M%p')
......
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