Add function to report devices activity
This commit is contained in:
@@ -3,6 +3,10 @@ import src.api as api
|
||||
import src.pki as pki
|
||||
import src.utils as utils
|
||||
import os
|
||||
import time
|
||||
|
||||
# TODO : turn off all relays
|
||||
# TODO : intialize GPIO
|
||||
|
||||
print("Check storage")
|
||||
if not os.path.isdir(args.storage):
|
||||
@@ -88,6 +92,13 @@ if not os.path.isfile(args.dev_crt_path):
|
||||
with open(args.dev_crt_path, "w") as f:
|
||||
f.write(cert)
|
||||
|
||||
api.report_log("Info", "Starting program main loop...", args.dev_id, args.priv_key)
|
||||
|
||||
print("Done. ready to operate.")
|
||||
api.sync_device(args.dev_id, args.priv_key)
|
||||
print("Ready to operate!.")
|
||||
while True:
|
||||
|
||||
# TODO : implement this loop more properly
|
||||
res = api.sync_device(args.dev_id, args.priv_key)
|
||||
print(res)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
Reference in New Issue
Block a user