From e0a8552f263bdb278392bb6b37eadc435a417b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 1 Jul 2022 22:44:22 +0200 Subject: [PATCH] added flask baxk and removed client loop thread and put client-loop in while loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 89a9352..f4e182c 100644 --- a/main.py +++ b/main.py @@ -92,7 +92,7 @@ def mqtt_on_message(client, userdata, msg): if __name__ == '__main__': - # app = Flask(__name__) + app = Flask(__name__) #api @app.route('/api/') @@ -205,10 +205,11 @@ if __name__ == '__main__': client.publish("server-rack-led-1/power","True") client.publish("server-rack-led-1/mode","0") - threading.Thread(target=lambda: client.loop_forever()) + # threading.Thread(target=lambda: client.loop_forever()) try: while True: + client.loop_forever() if power == "True": if mode == 0: rainbowCycle(strip)