def turn_lights_on(self): if self.turn_off_timer and self.turn_off_timer.is_alive(): self.turn_off_timer.cancel() self.lights_on = True if self.transition_settings["fade"]["enabled"]: start_daemon_thread(target=self.brightness_manager.do_fade_in, name="Fade in thread") self._logger.info("On message received, turning on LEDs to {}".format( self.previous_state)) self.parse_q_msg(self.previous_state)
def turn_lights_off(self): if self.transition_settings["fade"]["enabled"]: # Start fading brightness out start_daemon_thread(target=self.brightness_manager.do_fade_out, name="Fade out thread") # Set timer to turn LEDs off after fade self.turn_off_timer = start_daemon_timer( interval=float(self.transition_settings["fade"]["time"]) / 1000, target=self.lights_off, ) else: self.lights_off() self._logger.info( "Off message received, turning off LEDs (fade: {})".format( self.transition_settings["fade"]["enabled"]))
def run_effect(self, target, kwargs=None, name="WS281x Effect"): if kwargs is None: kwargs = {} self.stop_effect() # Targets error handler, which passes off to the effect with effect_args self.effect_thread = start_daemon_thread( target=error_handled_effect, kwargs={ "target": target, "logger": self._logger, "effect_args": kwargs }, name=name, )
def on_startup(self, host, port): util.start_daemon_thread( target=self.run_os_config_check, kwargs={"send_ui": False}, name="WS281x LED Status OS config test", )
def start_os_config_test(self): util.start_daemon_thread( target=self.plugin.run_os_config_check, name="WS281x LED Status OS Config Test", )