def sound(): while (True): siren.exterior(3, 1) # check for disarm try: panic = req.panic() except Exception: sound() if (panic['action'] == 'off'): try: req.updateAlarm('off') except Exception: wait() wait()
def wait(): print('Panic button ready. Waiting for action.') while (True): try: panic = req.panic() except Exception: wait() # check for an action if (panic['action'] == 'on'): # Sound the alarm try: req.updateAlarm('on') except Exception: sound() sound() time.sleep(config.searchFreq)