added more status pubs

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-12-27 19:44:14 +01:00
parent de6acca1eb
commit eb12c8ab28
1 changed files with 10 additions and 2 deletions

12
main.py
View File

@ -190,30 +190,38 @@ if __name__ == '__main__':
client.on_connect = mqtt_on_connect client.on_connect = mqtt_on_connect
client.on_message = mqtt_on_message client.on_message = mqtt_on_message
client.publish("server-rack-led/power", "True") client.publish("server-rack-led/power/status", "True")
client.publish("server-rack-led/mode", "Rainbow") client.publish("server-rack-led/mode/status", "Rainbow")
try: try:
client.loop_start() client.loop_start()
while True: while True:
if power == "True": if power == "True":
client.publish("server-rack-led/power/status", "True")
if singleExecute == True: if singleExecute == True:
fade_in_animation(strip, mode, Color(int(r), int(g), int(b))) fade_in_animation(strip, mode, Color(int(r), int(g), int(b)))
singleExecute = False singleExecute = False
if mode == 0: if mode == 0:
rainbowCycle(strip) rainbowCycle(strip)
client.publish("server-rack-led/mode/status", "Rainbow")
elif mode == 1: elif mode == 1:
setColor(strip, Color(int(r), int(g), int(b))) setColor(strip, Color(int(r), int(g), int(b)))
client.publish("server-rack-led/mode/status", "Custom Color")
elif mode == 2: elif mode == 2:
strobe(strip, Color(int(r), int(g), int(b))) strobe(strip, Color(int(r), int(g), int(b)))
client.publish("server-rack-led/mode/status", "Strobe")
elif mode == 3: elif mode == 3:
randomColor(strip) randomColor(strip)
client.publish("server-rack-led/mode/status", "Random Color")
elif mode == 4: elif mode == 4:
randomColorPerLED(strip) randomColorPerLED(strip)
client.publish("server-rack-led/mode/status", "Random Color per LED")
elif mode == 5: elif mode == 5:
colorFadeIn(strip) colorFadeIn(strip)
client.publish("server-rack-led/mode/status", "Color fade-in")
else: else:
client.publish("server-rack-led/power/status", "False")
if singleExecute == True: if singleExecute == True:
singleExecute = False singleExecute = False
setColor(strip, Color(0,0,0)) setColor(strip, Color(0,0,0))