short, short, long only works in lounge now

This commit is contained in:
Markus Schmidl 2017-02-18 03:27:21 +01:00
parent ce17854095
commit 7e4f71e81f
1 changed files with 6 additions and 1 deletions

View File

@ -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: