diff options
author | David Phillips <david@sighup.nz> | 2018-08-28 18:06:37 +1200 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2018-08-28 18:06:37 +1200 |
commit | 37e80e62d431a3effd2c24ced3b01a4da904a5e4 (patch) | |
tree | 2c0b737046f9338c81d6e844171feb4068950e4f /alarm-tools | |
parent | 1ad1390e5663f44bbfe9d93a449018e6a89123d4 (diff) | |
download | alarmd-37e80e62d431a3effd2c24ced3b01a4da904a5e4.tar.xz |
Add TODO file, sample Python alarms client
Diffstat (limited to 'alarm-tools')
-rwxr-xr-x | alarm-tools/sample.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/alarm-tools/sample.py b/alarm-tools/sample.py new file mode 100755 index 0000000..0adac18 --- /dev/null +++ b/alarm-tools/sample.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# NOTE: Requires PYTHONPATH to be set to ../lib/python if using the working +# tree module + +import alarms +import time + +if __name__ == "__main__": + sock = alarms.connect("/tmp/alarmd") + uuid = alarms.register_alarm(sock, "Test alarm") + time.sleep(10) + alarms.raise_alarm(sock, uuid) + time.sleep(10) + alarms.clear_alarm(sock, uuid) + time.sleep(10) + alarms.deregister_alarm(sock, uuid) + alarms.disconnect(sock) |