butler.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:garage-butler 作者: gurumitts 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号