def add_sensor(self, sensor, settings=None):
self.pin = int(sensor['pin'])
GPIO.setup(self.pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.remove_event_detect(self.pin)
GPIO.add_event_detect(
self.pin, GPIO.BOTH,
callback=self._checkInputPinState,
bouncetime=600)
self._checkInputPinState(self.pin)
self.setAlertStatus()
评论列表
文章目录