From 3e1f60fa22bd0652739d471d52f33b736bb1f3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Sun, 18 Feb 2024 00:07:04 +0100 Subject: [PATCH] fixed mqtt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/app.py b/server/app.py index 7be23a3..221184c 100644 --- a/server/app.py +++ b/server/app.py @@ -114,16 +114,9 @@ def connect_mqtt(): return client def mqtt_publisher(): - # Set Connecting Client ID - mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2) - # client.username_pw_set(username, password) - mqtt_client.on_message = on_message - mqtt_client.connect("localhost", 1883) # Create and start a thread for each universe artnetBindIp = get_eth0_ip() artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454) - mqtt_client.subscribe("pxm/tube_index") - mqtt_client.loop_start() while True: try: # Gets whatever the last Art-Net packet we received is @@ -166,4 +159,7 @@ if __name__ == "__main__": update_tube_index_thread.start() flask_thread = Process(target=flask_api) flask_thread.start() + mqtt_client = connect_mqtt() + mqtt_client.subscribe("pxm/tube_index") + mqtt_client.loop_start() mqtt_publisher() \ No newline at end of file