added flask baxk and removed client loop thread and put client-loop in while loop

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-01 22:44:22 +02:00
parent d493b6a9ec
commit e0a8552f26
1 changed files with 3 additions and 2 deletions

View File

@ -92,7 +92,7 @@ def mqtt_on_message(client, userdata, msg):
if __name__ == '__main__': if __name__ == '__main__':
# app = Flask(__name__) app = Flask(__name__)
#api #api
@app.route('/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/power","True")
client.publish("server-rack-led-1/mode","0") client.publish("server-rack-led-1/mode","0")
threading.Thread(target=lambda: client.loop_forever()) # threading.Thread(target=lambda: client.loop_forever())
try: try:
while True: while True:
client.loop_forever()
if power == "True": if power == "True":
if mode == 0: if mode == 0:
rainbowCycle(strip) rainbowCycle(strip)