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_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))