1 from libtuer import ThreadFunction, logger
2 import RPi.GPIO as GPIO
10 CMD_BUZZ: ("buzz", 12, [(True, 0.3), (False, 2.0)]),
11 CMD_OPEN: ("open", 16, [(None, 0.2), (True, 0.3), (False, 1.0)]),
12 CMD_CLOSE: ("close", 22, [(None, 0.2), (True, 0.3), (False, 1.0)]),
16 self.act = ThreadFunction(self._act)
17 for (name, pin, todo) in self.CMDs.values():
18 GPIO.setup(pin, GPIO.OUT)
22 (name, pin, todo) = self.CMDs[cmd]
23 logger.info("Actor: Running command %s" % name)
24 for (value, delay) in todo:
26 GPIO.output(pin, value)
29 logger.error("Actor: Gut unknown command %d" % cmd)