Exemple #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)
Exemple #2
0
 def setDetection():
     newStatus = request.args.get('status')
     logger.info("Received %s" %(request.url))
     active.setDetection(newStatus)
     return json.dumps(active.getDetection())