From eb12c8ab28e0aecd07b05b10c76213b644e6183d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 27 Dec 2022 19:44:14 +0100 Subject: [PATCH] added more status pubs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9c4c67d..fa7f912 100644 --- a/main.py +++ b/main.py @@ -190,30 +190,38 @@ if __name__ == '__main__': client.on_connect = mqtt_on_connect client.on_message = mqtt_on_message - client.publish("server-rack-led/power", "True") - client.publish("server-rack-led/mode", "Rainbow") + client.publish("server-rack-led/power/status", "True") + client.publish("server-rack-led/mode/status", "Rainbow") try: client.loop_start() while True: if power == "True": + client.publish("server-rack-led/power/status", "True") if singleExecute == True: fade_in_animation(strip, mode, Color(int(r), int(g), int(b))) singleExecute = False if mode == 0: rainbowCycle(strip) + client.publish("server-rack-led/mode/status", "Rainbow") elif mode == 1: setColor(strip, Color(int(r), int(g), int(b))) + client.publish("server-rack-led/mode/status", "Custom Color") elif mode == 2: strobe(strip, Color(int(r), int(g), int(b))) + client.publish("server-rack-led/mode/status", "Strobe") elif mode == 3: randomColor(strip) + client.publish("server-rack-led/mode/status", "Random Color") elif mode == 4: randomColorPerLED(strip) + client.publish("server-rack-led/mode/status", "Random Color per LED") elif mode == 5: colorFadeIn(strip) + client.publish("server-rack-led/mode/status", "Color fade-in") else: + client.publish("server-rack-led/power/status", "False") if singleExecute == True: singleExecute = False setColor(strip, Color(0,0,0))