def door_check(self, channel):
time.sleep(3)
status = GPIO.input(button_pin)
db = get_db()
# logging.getLogger('garage').info('status = %s, last status = %s' % (status, self.last_status))
if status == 1:
if status != self.last_status:
db.record_door_closed()
logging.getLogger('garage').info('Door closed')
self.notify.notify()
else:
pass
# logging.getLogger('garage').info('Door closed again')
else:
if status != self.last_status:
db.record_door_opened()
logging.getLogger('garage').info('Door opened')
self.notify.notify()
self.camera.take_picture()
else:
pass
# logging.getLogger('garage').info('Door opened again')
db.shutdown()
self.last_status = status
评论列表
文章目录