mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
Use a single MQTT task.
This commit is contained in:
3
main.py
3
main.py
@@ -18,8 +18,7 @@ async def main(args):
|
||||
|
||||
await database.create_tables()
|
||||
async with asyncio.TaskGroup() as tg:
|
||||
for topic in args.topic:
|
||||
tg.create_task(load_database_from_mqtt(topic))
|
||||
tg.create_task(load_database_from_mqtt(args.topic))
|
||||
tg.create_task(web.run_server(args.bind, args.port, args.tls_cert))
|
||||
if args.acme_challenge:
|
||||
tg.create_task(http.run_server(args.bind, args.acme_challenge))
|
||||
|
||||
@@ -26,13 +26,14 @@ def decrypt(packet):
|
||||
pass
|
||||
|
||||
|
||||
async def get_topic_envelopes(topic):
|
||||
async def get_topic_envelopes(topics):
|
||||
while True:
|
||||
try:
|
||||
async with aiomqtt.Client(
|
||||
"mqtt.meshtastic.org", username="meshdev", password="large4cats"
|
||||
) as client:
|
||||
await client.subscribe(topic)
|
||||
for topic in topics:
|
||||
await client.subscribe(topic)
|
||||
async for msg in client.messages:
|
||||
try:
|
||||
envelope = ServiceEnvelope.FromString(msg.payload)
|
||||
|
||||
Reference in New Issue
Block a user