diff --git a/main.py b/main.py index 5bc619a..90fe151 100644 --- a/main.py +++ b/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)) diff --git a/meshview/mqtt_reader.py b/meshview/mqtt_reader.py index 16ce423..b047810 100644 --- a/meshview/mqtt_reader.py +++ b/meshview/mqtt_reader.py @@ -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)