update version

This commit is contained in:
Pablo Revilla
2025-06-24 13:46:23 -07:00
parent 7d8a757788
commit f462889b62
2 changed files with 21 additions and 4 deletions
+19 -3
View File
@@ -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)
+2 -1
View File
@@ -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}"