From d526864603568a23e82ac50d5bf016838214ff8a Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Tue, 30 Jul 2024 18:44:25 +0200 Subject: [PATCH] oops --- printout.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/printout.py b/printout.py index 778a587..1260e28 100644 --- a/printout.py +++ b/printout.py @@ -14,7 +14,7 @@ try: with open(argv[1], "rb") as f: config = load(f) TITLE = config["printout"]["title"] - MQTT_SUB = "{}/#".format(config["mqtt"]["prefix"]) + MQTT_SUB = "{}/".format(config["mqtt"]["prefix"]) except Exception as e: print(f"Usage: {argv[0]} config.toml") exit(1) @@ -58,7 +58,7 @@ mqtt_data = {} def on_connect(client, userdata, flags, rc): LOG.info(f"Connected to mqtt server") - mqtt.subscribe(MQTT_SUB) + mqtt.subscribe(f"{MQTT_SUB}#") LOG.info(f"subscribing to {MQTT_SUB}") @@ -103,20 +103,20 @@ def generate_layout(): try: - LOG.info('mooooin!') + LOG.info("mooooin!") mqtt = mqtt.Client() mqtt.on_connect = on_connect mqtt.on_disconnect = on_disconnect mqtt.on_message = on_message mqtt.connect(config["mqtt"]["host"], config["mqtt"]["port"], 10) - LOG.info('starting loop') + LOG.info("starting loop") mqtt.loop_start() with Live(generate_layout(), screen=True) as live: while True: live.update(generate_layout()) sleep(0.5) mqtt.loop_stop() - LOG.info('bye') + LOG.info("bye") except Exception: LOG.exception("oops")