Ejemplo n.º 1
0
def main():
    # main

    # activate API
    if api.lunch():
        logger.info("API started")
    else:
        logger.error("API failed start")

    GPIO.setmode(GPIO.BOARD)
    pir = 26
    GPIO.setup(pir, GPIO.IN)
    logger.info("Application started")
    while True:
        while active.getActive():
            if GPIO.input(pir):
                time.sleep(1)
                if GPIO.input(pir):
                    active.setDetection("true")
                    sender.emailAlert()
                    active.setDetection("false")
                    time.sleep(0.2)
Ejemplo n.º 2
0
 def setStatus():
     newStatus = request.args.get('status')
     logger.info("Received %s" %(request.url))
     active.setActive(newStatus)
     return json.dumps(active.getActive())
Ejemplo n.º 3
0
 def getStatus():
     logger.info("Received %s" %(request.url))
     return json.dumps(active.getActive())