forked from eavanvalkenburg/pysiaalarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
31 lines (22 loc) · 739 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
import logging
import time
from pysiaalarm import SIAAccount, SIAClient, SIAEvent
logging.basicConfig(level=logging.DEBUG)
events = []
def func(event: SIAEvent):
events.append(event)
with open("local_config.json", "r") as f:
config = json.load(f)
print("Config: ", config)
account = [SIAAccount(config["account_id"], config["key"])]
sleep_time = 1200
with SIAClient(config["host"], config["port"], account, function=func) as client:
time.sleep(sleep_time)
counts = client.counts
# for ev in events:
# print(ev)
print("--------------------------------------------------")
print("Number of events: ", len(events))
print("Counts: ", counts)
print("--------------------------------------------------")