diff --git a/chch-power.py b/chch-power.py index f04d64f..8967e57 100644 --- a/chch-power.py +++ b/chch-power.py @@ -29,6 +29,8 @@ def switch_unpressed(event): switch_verylongpressed(event) pin_last_rise_date[event.pin_num] = 0 +# toggle current room's power with a short and a long press +# call a script with two short and a long press def switch_longpressed(event): shortpress_delay = pin_last_rise_date[event.pin_num] - pin_last_shortpress[event.pin_num] if shortpress_delay > inter_press_max_delay: @@ -36,8 +38,11 @@ def switch_longpressed(event): elif pin_shortpress_count[event.pin_num] == 1: event.chip.output_pins[event.pin_num].toggle() elif pin_shortpress_count[event.pin_num] == 2: - call(["/root/chch-power/light.sh"]) + if event.pin_num == 0: + call(["/root/chch-power/light.sh"]) +# switch all power off with a very long press +# switch all power on with a short and a very long press def switch_verylongpressed(event): shortpress_delay = pin_last_rise_date[event.pin_num] - pin_last_shortpress[event.pin_num] if shortpress_delay > inter_press_max_delay: