# handle_wakeup_event intentionally not overwritten
class StateClosing(State):
# handle_wakeup_event intentionally not overwritten
class StateClosing(State):
+ # FIXME: Why does this even have callbacks?
# TODO: share code with StateOpening, and possibly also with the nerv-mechanism from StateAboutToOpen
# TODO: share code with StateOpening, and possibly also with the nerv-mechanism from StateAboutToOpen
- def __init__(self,callback,sm):
+ def __init__(self,sm):
super().__init__(sm)
super().__init__(sm)
- self.callbacks=[callback]
+ self.callbacks=[]
# FIXME: can we send "202 processing: Trying to close the door" here? Are the callbacks multi-use?
self.tries = 0
# FIXME: can we send "202 processing: Trying to close the door" here? Are the callbacks multi-use?
self.tries = 0
+ assert self.pins().door_closed, "Door is open while we should close it, this must not happen"
self.actor().act(Actor.CMD_CLOSE)
def notify(self, did_it_work):
s = "200 okay: door closed" if did_it_work else ("500 internal server error: Couldn't close door with %d tries à %f seconds" % (CLOSE_REPEAT_NUMBER,CLOSE_REPEAT_TIMEOUT))
self.actor().act(Actor.CMD_CLOSE)
def notify(self, did_it_work):
s = "200 okay: door closed" if did_it_work else ("500 internal server error: Couldn't close door with %d tries à %f seconds" % (CLOSE_REPEAT_NUMBER,CLOSE_REPEAT_TIMEOUT))