mirror of
https://codeberg.org/mclemens/pyBMNotify.git
synced 2025-02-21 06:57:32 -05:00
initial commit
This commit is contained in:
parent
8c1dab0136
commit
8faa221160
35
pyBMNotify.py
Normal file
35
pyBMNotify.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user