From 83dd8fca5157883a8679e8ac4080b77ff8d2d537 Mon Sep 17 00:00:00 2001 From: Shy Date: Tue, 18 Apr 2017 18:38:32 +0200 Subject: [PATCH] Bugfix in for --skip-if-off --- kitchentext | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kitchentext b/kitchentext index fca2f76..309f28e 100755 --- a/kitchentext +++ b/kitchentext @@ -55,12 +55,13 @@ def kitchentext(delay=200, skip_if_off=False, poweron=False, restore=False, if skip_if_off: # Stop here if kitchenlight is turned off. - if saved_state[1].payload == b'\x00': - verbose and print("Found Kitchenlight turned off and '-i' flag given. Exiting.") - return + for state in saved_state: + if state.topic == kl.powertopic and state.payload == b'\x00': + verbose and print("Found Kitchenlight turned off and '-i' flag given. Exiting.") + return # We want to be able to restore the saved Kitchenlight if we receive a - # SIGERM signal. We do this by creating an registering a custom exception + # SIGERM signal. We do this by creating and registering a custom exception # class. class KitchenSignalError(Exception): def __init__(self, signal, frame):