def sound(fault): i = 0 while(True): try: alarm = req.alarm() except Exception: sound(fault) if (alarm['action'] == 'disarm'): try: req.updateAlarm('off') except Exception: unarmed() unarmed() siren.interior(.05, 2) i += 1 # after the predefined number of warning # tones, sound the loud siren if (i > config.delay): # send messages try: req.mailFault(fault) req.addFault(fault) except Exception: loud(fault) # trigger siren loud(fault)
def chirp(): siren.interior(.05, 1) print('alarm should be off')