From 8faa22116082a2e68d7337119aac8f6112000423 Mon Sep 17 00:00:00 2001 From: Michael Clemens Date: Mon, 7 Dec 2020 18:00:49 +0100 Subject: [PATCH] initial commit --- pyBMNotify.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pyBMNotify.py diff --git a/pyBMNotify.py b/pyBMNotify.py new file mode 100644 index 0000000..7b1f46c --- /dev/null +++ b/pyBMNotify.py @@ -0,0 +1,35 @@ +from socketIO_client import SocketIO +import json + +tg = 98002 + +def on_connect(): + print('connect') + +def on_disconnect(): + print('disconnect') + +def on_reconnect(): + print('reconnect') + +def on_mqtt(*args): + found = False + out = "" + call = json.loads(args[0]['payload']) + for key,value in call.items(): + if key == "DestinationID" and value == tg: + found = True + if found and key == "SourceCall": + out += value + if found and key == "SourceName": + out += " - " + value + if out: + print(out) + + +socket = SocketIO('https://api.brandmeister.network/lh') +socket.on('connect', on_connect) +socket.on('disconnect', on_disconnect) +socket.on('reconnect', on_reconnect) +socket.on('mqtt', on_mqtt) +socket.wait()