ABOUTOPEN_NERVLIST=[(5,lambda:play_sound("flipswitch")),(5,lambda:play_sound("flipswitch")),(0,lambda:Logger.warning("Space open but switch not flipped for 10 seconds")),\
(10,lambda:play_sound("flipswitch")),(10,lambda:play_sound("flipswitch")),(0,lambda:Logger.error("Space open but switch not flipped for 30 seconds")),\
(10,lambda:play_sound("flipswitch")),(10,lambda:play_sound("flipswitch")),(6,lambda:play_sound("flipswitch")),(4,lambda:Logger.critical("Space open but switch not flipped for 60 seconds"))]
ABOUTOPEN_NERVLIST=[(5,lambda:play_sound("flipswitch")),(5,lambda:play_sound("flipswitch")),(0,lambda:logger.warning("Space open but switch not flipped for 10 seconds")),\
(10,lambda:play_sound("flipswitch")),(10,lambda:play_sound("flipswitch")),(0,lambda:logger.error("Space open but switch not flipped for 30 seconds")),\
(10,lambda:play_sound("flipswitch")),(10,lambda:play_sound("flipswitch")),(6,lambda:play_sound("flipswitch")),(4,lambda:logger.critical("Space open but switch not flipped for 60 seconds"))]
# StateAuf constants
# time that must pass between two bell_ringing events to buzz the door again (seconds)
...
...
@@ -33,7 +33,7 @@ AUF_BELLBUZZ_REPEAT_TIME = 2
# Timeout we wait after the switch was switched to "Closed", until we assume nobody will open the door and we just lock it
# ALso the time we wait after the door was opend, till we assume something went wrong and start nerving
LEAVE_TIMEOUT=30
LEAVE_TIMEOUT=20
# play_sound constants
SOUNDS_DIRECTORY="/opt/tuer/sounds/"
...
...
@@ -49,11 +49,11 @@ class Nerver():
defnerv(self):
iflen(self.nervlist):
(time,f)=self.nervlist[0]
(wait_time,f)=self.nervlist[0]
now=time.time()
time_gone=now-self.last_event_time
# check if the first element is to be triggered
iftime_gone>=time:
iftime_gone>=wait_time:
self.nervlist=self.nervlist[1:]# "pop" the first element, but do not modify original list
self.last_event_time=now
returnf()
...
...
@@ -74,7 +74,7 @@ class StateMachine():
defhandle_pins_event(self):
pass# one needn't implement this
defhandle_buzz_event(self,arg):# this shouldn't be overwritten