Bugfix in for --skip-if-off
This commit is contained in:
parent
5c5a404ba5
commit
83dd8fca51
1 changed files with 5 additions and 4 deletions
|
@ -55,12 +55,13 @@ def kitchentext(delay=200, skip_if_off=False, poweron=False, restore=False,
|
||||||
|
|
||||||
if skip_if_off:
|
if skip_if_off:
|
||||||
# Stop here if kitchenlight is turned off.
|
# Stop here if kitchenlight is turned off.
|
||||||
if saved_state[1].payload == b'\x00':
|
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.")
|
verbose and print("Found Kitchenlight turned off and '-i' flag given. Exiting.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# We want to be able to restore the saved Kitchenlight if we receive a
|
# 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.
|
||||||
class KitchenSignalError(Exception):
|
class KitchenSignalError(Exception):
|
||||||
def __init__(self, signal, frame):
|
def __init__(self, signal, frame):
|
||||||
|
|
Loading…
Reference in a new issue