mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-08-07 01:12:54 +02:00
update version
This commit is contained in:
+19
-3
@@ -30,20 +30,36 @@ async def get_topic_envelopes(mqtt_server, mqtt_port, topics, mqtt_user, mqtt_pa
|
||||
while True:
|
||||
try:
|
||||
async with aiomqtt.Client(
|
||||
mqtt_server, port=mqtt_port , username=mqtt_user, password=mqtt_passwd , identifier=identifier,
|
||||
mqtt_server,
|
||||
port=mqtt_port,
|
||||
username=mqtt_user,
|
||||
password=mqtt_passwd,
|
||||
identifier=identifier,
|
||||
) as client:
|
||||
for topic in topics:
|
||||
print(topic)
|
||||
print(f"Subscribing to: {topic}")
|
||||
await client.subscribe(topic)
|
||||
|
||||
async for msg in client.messages:
|
||||
try:
|
||||
envelope = ServiceEnvelope.FromString(msg.payload)
|
||||
print(envelope)
|
||||
except DecodeError:
|
||||
continue
|
||||
|
||||
decrypt(envelope.packet)
|
||||
|
||||
if not envelope.packet.decoded:
|
||||
continue
|
||||
|
||||
# Skip packets from specific node
|
||||
if getattr(envelope.packet, "from", None) == 2144342101:
|
||||
continue
|
||||
|
||||
# ✅ Print decoded packet
|
||||
print("Decoded Packet:", envelope.packet.decoded)
|
||||
|
||||
yield msg.topic.value, envelope
|
||||
|
||||
except aiomqtt.MqttError as e:
|
||||
print(f"MQTT error: {e}, reconnecting in 1s...")
|
||||
await asyncio.sleep(1)
|
||||
|
||||
@@ -15,7 +15,8 @@ async def process_envelope(topic, env):
|
||||
|
||||
# Checking if the received packet is a MAP_REPORT
|
||||
# Update the node table with the firmware version
|
||||
if env.packet.decoded.portnum == PortNum.MAP_REPORT_APP:
|
||||
#if env.packet.decoded.portnum == PortNum.MAP_REPORT_APP:
|
||||
if env.packet.decoded.portnum == 0:
|
||||
# Extract the node ID from the packet and format the user ID
|
||||
node_id = getattr(env.packet, "from")
|
||||
user_id = f"!{node_id:0{8}x}"
|
||||
|
||||
Reference in New Issue
Block a user