diff --git a/config.ini b/config.ini index 693429b..9b4e152 100644 --- a/config.ini +++ b/config.ini @@ -6,7 +6,7 @@ acme_challenge = [mqtt] server = mqtt.bayme.sh -topics = ['msh/US/bayarea/#', 'msh/US/CA/mrymesh/#'] +topics = ["msh/US/bayarea/#"] port = 1883 username = meshdev password = large4cats diff --git a/main.py b/main.py index 7accc67..f92a106 100644 --- a/main.py +++ b/main.py @@ -6,6 +6,7 @@ from meshview import database from meshview import store from meshview import web from meshview import http +import json async def load_database_from_mqtt(mqtt_server: str , mqtt_port: int, topic: str, mqtt_user: str | None = None, mqtt_passwd: str | None = None): @@ -23,10 +24,11 @@ async def main(config): mqtt_user: str = config["mqtt"]["username"] if config["mqtt"]["password"] != "": mqtt_passwd: str = config["mqtt"]["password"] + mqtt_topics = json.loads(config["mqtt"]["topics"]) async with asyncio.TaskGroup() as tg: tg.create_task( - load_database_from_mqtt(config["mqtt"]["server"], int(config["mqtt"]["port"]), config["mqtt"]["topics"], mqtt_user, mqtt_passwd) + load_database_from_mqtt(config["mqtt"]["server"], int(config["mqtt"]["port"]), mqtt_topics, mqtt_user, mqtt_passwd) ) tg.create_task( web.run_server( diff --git a/meshview/mqtt_reader.py b/meshview/mqtt_reader.py index 5215f98..c63d3ce 100644 --- a/meshview/mqtt_reader.py +++ b/meshview/mqtt_reader.py @@ -33,6 +33,7 @@ async def get_topic_envelopes(mqtt_server, mqtt_port, topics, mqtt_user, mqtt_pa mqtt_server, port=mqtt_port , username=mqtt_user, password=mqtt_passwd , identifier=identifier, ) as client: for topic in topics: + print(topic) await client.subscribe(topic) async for msg in client.messages: try: diff --git a/meshview/templates/net.html b/meshview/templates/net.html index b16e0db..9d6fcbb 100644 --- a/meshview/templates/net.html +++ b/meshview/templates/net.html @@ -24,7 +24,7 @@