From 43590d02e0773247b051069d5c27b5ffed591237 Mon Sep 17 00:00:00 2001 From: Rich Date: Sun, 17 Apr 2016 17:00:01 -0400 Subject: [PATCH] Added code to turn off lights listed in off.lights file --- hue_off.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hue_off.py b/hue_off.py index af9576a..681ebb0 100755 --- a/hue_off.py +++ b/hue_off.py @@ -86,7 +86,17 @@ def main(argv): print "Error reading file." if prev_status[1] == bridge: + # Same bridge as before, apply the light status! + lights_list = bridge.get_light_objects('list') + # Since the only names in the file are lights that should be off + # let's turn any light name in the file off. + print "Searching off.lights for lights that were previously off..." + for light in lights_list: + for line in prev_status: + if light.name == line: + light.on = "off" + print "Turning off: %s" % line try: