Last active
August 29, 2015 14:02
-
-
Save highfestiva/2d00c0cff61a0a0190da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
active = device.active | |
inactive = lambda: not active() | |
while inactive(): | |
yield | |
active_init_blip(device) | |
statewait(inactive, timeout=initiation_timeout) | |
if inactive(): | |
inactive_blip(device) | |
return | |
active_running_blip(device) | |
statewait(inactive_reset, timeout=warning_timeout) | |
while active(): | |
if device.triggered(): | |
statewait(inactive, timeout=warning_timeout) # Give a chance to turn it off. | |
if active(): | |
warning_blip(device) | |
statewait(inactive, timeout=trigger_timeout) | |
if inactive(): | |
inactive_blip(device) | |
return | |
starthonk(device) # ALARM: intruder alert! | |
statewait(inactive, timeout=siren_timeout) | |
stophonk(device) | |
device.triggered(False) | |
inactive_blip(device) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment