From c60bffabb34af917866b43179691f537047fa025 Mon Sep 17 00:00:00 2001 From: Rich Date: Tue, 12 Apr 2016 14:55:01 -0400 Subject: [PATCH 1/3] fixing some things --- hue_off.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hue_off.py b/hue_off.py index 239c4db..dc02e97 100755 --- a/hue_off.py +++ b/hue_off.py @@ -82,13 +82,18 @@ def main(argv): try: with open("off.lights") as f: prev_status = f.readlines() + f.close() except: print "Error reading file." - if prev_status[1] == bridge: - - """ - + for line in prev_status: + print(line) + raw_input("Press Enter") + print(prev_status[1]) + raw_input("Press Enter Again") + #if prev_status[1] == bridge: + """ + try: bridge = Bridge(bridgeIP) @@ -113,7 +118,7 @@ def main(argv): lights_file.truncate() lights_file.write(datestamp()) lights_file.write("\n") - lights_file.write(bridge) + lights_file.write(bridgeIP) lights_file.write("\n") # Store list of lights that are currently off off_lights = [] From ca3d37277dfaaa1c5a1978c9e93bdab3c1b80359 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 15 Apr 2016 10:03:41 -0400 Subject: [PATCH 2/3] Printing read-in contents of file --- hue_off.py | 9 +++++++-- off.lights | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 off.lights diff --git a/hue_off.py b/hue_off.py index dc02e97..b6e88d5 100755 --- a/hue_off.py +++ b/hue_off.py @@ -77,22 +77,27 @@ def main(argv): raw_input("Press enter to continue") """ - """ + # Read in status from last time app ran + # try: with open("off.lights") as f: prev_status = f.readlines() f.close() + except: print "Error reading file." + # Print the read-in contents of file for line in prev_status: print(line) + + """ raw_input("Press Enter") print(prev_status[1]) raw_input("Press Enter Again") #if prev_status[1] == bridge: - """ + """ try: diff --git a/off.lights b/off.lights new file mode 100644 index 0000000..240fc75 --- /dev/null +++ b/off.lights @@ -0,0 +1,8 @@ +20160412-145432 +10.3.0.102 +Living Room FL2 +Living Room FL1 +Ugly FL +Living Room Pharmacy +Bedroom 1 +Back Door From c81b482d671a51a92cba2911b94a7cc5e0155acd Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 15 Apr 2016 10:18:29 -0400 Subject: [PATCH 3/3] commited to wrong branch... commented out read file stuff an recommitting --- hue_off.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hue_off.py b/hue_off.py index b6e88d5..6667d7f 100755 --- a/hue_off.py +++ b/hue_off.py @@ -77,7 +77,7 @@ def main(argv): raw_input("Press enter to continue") """ - + """ # Read in status from last time app ran # try: @@ -92,13 +92,13 @@ def main(argv): for line in prev_status: print(line) - """ + raw_input("Press Enter") print(prev_status[1]) raw_input("Press Enter Again") #if prev_status[1] == bridge: - """ - + + """ try: bridge = Bridge(bridgeIP)