Fix User Profile and Repeater Links

This commit is contained in:
Marcus Kida 2026-08-13 17:23:38 +02:00
parent 7f08a655d8
commit 2fbd529c93

10
main.py
View file

@ -95,7 +95,7 @@ for master in bm_clustermasters_json:
# SocketIO setup for the MQTT socket handling
sio = socketio.Client(reconnection=True, reconnection_attempts=0, reconnection_delay=5, reconnection_delay_max=60)
@sio.event
def connect():
print('connected to server')
@ -103,11 +103,11 @@ def connect():
# otherwise the server keeps the connection open but sends no data.
sio.emit("join", "everything")
print('subscribed to LastHeard stream (join/everything)')
@sio.event
def disconnect():
print('disconnected from server, reconnecting...')
@sio.on("mqtt")
def on_mqtt(data):
epoch_time = int(time.time())
@ -120,7 +120,7 @@ def on_mqtt(data):
max_old_time = epoch_time - 20
# Build the message that will be sent to Telegram
telegram_message = "Callsign: <b><a href='https://brandmeister.network/index.php?page=profile&call=" +jsondata["SourceCall"] + "'>" + jsondata["SourceCall"] + "</a></b> ID: <b>" + str(jsondata["SourceID"]) + " </b> \nName: " +jsondata["SourceName"] + " \nTalkeralias: <b>" + jsondata["TalkerAlias"] + "</b> \n-----------------------------------\nAccess via: <b>" + jsondata["LinkName"] + " </b>\nVia repeater: <b><a href='https://brandmeister.network/?page=device&id=" + str(jsondata["ContextID"]) + "'>" + jsondata["LinkCall"] + "</a></b>\nSlot: " + str(jsondata["Slot"]) + " TG: " + str(jsondata["DestinationID"]) + "\nMaster: " + str(jsondata["Master"]) + "\nRSSI: <b>" + str(jsondata["RSSI"]) + " dBm</b> BER: <b>" + str(round(jsondata["BER"],2)) + "%</b>"
telegram_message = "Callsign: <b><a href='https://brandmeister.network/#/profile/" +jsondata["SourceCall"] + "'>" + jsondata["SourceCall"] + "</a></b> ID: <b>" + str(jsondata["SourceID"]) + " </b> \nName: " +jsondata["SourceName"] + " \nTalkeralias: <b>" + jsondata["TalkerAlias"] + "</b> \n-----------------------------------\nAccess via: <b>" + jsondata["LinkName"] + " </b>\nVia repeater: <b><a href='https://brandmeister.network/#/device/" + str(jsondata["ContextID"]) + "'>" + jsondata["LinkCall"] + "</a></b>\nSlot: " + str(jsondata["Slot"]) + " TG: " + str(jsondata["DestinationID"]) + "\nMaster: " + str(jsondata["Master"]) + "\nRSSI: <b>" + str(jsondata["RSSI"]) + " dBm</b> BER: <b>" + str(round(jsondata["BER"],2)) + "%</b>"
context_id = _as_int(jsondata["ContextID"])
event_slot = _as_int(jsondata["Slot"])
@ -159,7 +159,7 @@ def on_mqtt(data):
print ("matched via Mirror-TG")
send_telegram_message(telegram_message)
return
bm_url = 'https://api.brandmeister.network'
bm_path = "/lh/socket.io"