From f31f971e63b70b1899e43fdcdd480333fcb274f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Fri, 1 Jul 2022 22:55:57 +0200 Subject: [PATCH] added global vars to mqtt_on_message 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, 5 insertions(+) diff --git a/main.py b/main.py index a87a88f..d5d30a1 100644 --- a/main.py +++ b/main.py @@ -168,19 +168,24 @@ if __name__ == '__main__': topic = str(msg.topic) payload = str(msg.payload.decode("utf-8")) if topic == "server-rack-led-1/power": + global power power = payload elif topic == "server-rack-led-1/r": + global r r = payload elif topic == "server-rack-led-1/g": + global g g = payload elif topic == "server-rack-led-1/b": + global b b = payload elif topic == "server-rack-led-1/mode": if payload == "0": + global mode mode = 0 elif payload == "1": mode = 1