added more info to output

This commit is contained in:
Michael Clemens 2020-12-07 19:07:57 +01:00
parent 95ad204e9f
commit 368e422f28

View File

@ -2,7 +2,7 @@ from socketIO_client import SocketIO
import json import json
import datetime as dt import datetime as dt
tg = 31650 tg = [31650, 98002]
id = "" id = ""
def on_connect(): def on_connect():
@ -18,9 +18,9 @@ def on_mqtt(*args):
out = "" out = ""
global id global id
call = json.loads(args[0]['payload']) call = json.loads(args[0]['payload'])
if call["DestinationID"] == tg and id != call["_id"]: if call["DestinationID"] in tg and id != call["_id"]:
time = dt.datetime.utcfromtimestamp(call["Start"]).strftime("%Y/%m/%d %H:%M") time = dt.datetime.utcfromtimestamp(call["Start"]).strftime("%Y/%m/%d %H:%M")
out += call["SourceCall"] + ' (' + call["SourceName"] + ') was active on ' + str(tg) + ' at ' + time out += call["SourceCall"] + ' (' + call["SourceName"] + ') was active on ' + str(call["DestinationID"]) + ' (' + call["DestinationName"] + ') at ' + time
print(out) print(out)
#print(json.dumps(call,separators=(',',':'),sort_keys=True,indent=4)) #print(json.dumps(call,separators=(',',':'),sort_keys=True,indent=4))
id = call["_id"] id = call["_id"]