Skip to content
Snippets Groups Projects
Commit 19814a24 authored by Martin Winter's avatar Martin Winter
Browse files

fix problem when mqtt server sends effect msg with empty key

parent 55f622f7
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,9 @@ def react(topic, msg, retained):
)
wled.set_color(led_number, msg[0], msg[1], msg[2], flush=True)
elif re.match(fr"{config.mqtt_topic}/effects", topic):
if msg[0] in config.functions:
if not msg:
pass
elif msg[0] in config.functions:
config.functions[msg[0]]["function"]()
async def main(mqtt):
......
......@@ -74,7 +74,7 @@ def set_color(led_id: int, red: int, green: int, blue: int, white: int = 0, flus
if flush:
leds.write()
def party(time_in_seconds: int):
def party(time_in_seconds: int = 10):
# Save colors
_save_state()
......@@ -90,7 +90,7 @@ def party(time_in_seconds: int):
# Recover old colors
_recover_state()
def rainbow(time_in_seconds: int):
def rainbow(time_in_seconds: int = 10):
# Save colors
_save_state()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment