diff --git a/mycodo/functions/function_adafruit_neokey_01.py b/mycodo/functions/function_adafruit_neokey_01.py index 518c4bda5..fcdab47e8 100644 --- a/mycodo/functions/function_adafruit_neokey_01.py +++ b/mycodo/functions/function_adafruit_neokey_01.py @@ -344,7 +344,7 @@ def listener(self): while self.running: # Check key press for key in range(4): - if self.neokey[key] and not self.key_press_executing[key]: + if not self.key_press_executing[key] and self.neokey[key]: self.key_press_executing[key] = True self.logger.debug(f"Key {key + 1} Pressed") self.set_color({"led_number": key, "led_color": self.options_channels['led_start'][key]}) @@ -359,6 +359,7 @@ def listener(self): key_thread = threading.Thread( target=self.run_key_actions, args=(key,)) + key_thread.daemon = True key_thread.start() # Check for flashing @@ -374,7 +375,7 @@ def listener(self): self.flashing[key]["on"] = True self.set_color({"led_number": key, "led_color": self.flashing[key]["color"]}) - time.sleep(0.05) + time.sleep(0.1) def stop_function(self): self.running = False @@ -445,7 +446,6 @@ def set_color(self, dict_payload): "Improper RGB color format. " "Must be three values, separated by commas, between 0 and 255 each. For example: 10, 0, 255") - def flashing_on(self, dict_payload): if "led_number" not in dict_payload: self.logger.error("Missing key 'led_number'")