diff --git a/printout.py b/printout.py index b6c75bb..778a587 100644 --- a/printout.py +++ b/printout.py @@ -50,7 +50,7 @@ TABLE_LAYOUT = { }, } -# logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.DEBUG) LOG = logging.getLogger(__name__) mqtt_data = {} @@ -59,6 +59,7 @@ mqtt_data = {} def on_connect(client, userdata, flags, rc): LOG.info(f"Connected to mqtt server") mqtt.subscribe(MQTT_SUB) + LOG.info(f"subscribing to {MQTT_SUB}") def on_disconnect(client, userdata, rc): @@ -102,16 +103,20 @@ def generate_layout(): try: + 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) - mqtt.loop_start() + 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') except Exception: LOG.exception("oops")