Przeglądaj źródła

fix(mqtt): apply clear pattern when selecting a single pattern (#123)

Adapted from PR #123 onto the firmware-delegated execution path:
run_pattern's clear_pattern kwarg now maps to the $Sand/Run clear
mode via map_clear_mode, so the HA-configured clear pattern runs
before a single pattern, matching the web UI's pre_execution
behavior.

(cherry picked from commit ef7771464bbaba39d24dfb7c0c59a82aa7863418)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
M8te 6 dni temu
rodzic
commit
47b822a29b
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      modules/mqtt/handler.py

+ 4 - 1
modules/mqtt/handler.py

@@ -699,7 +699,10 @@ class MQTTHandler(BaseMQTTHandler):
                 if pattern_name in self.patterns:
                     # Schedule the coroutine to run in the main event loop
                     asyncio.run_coroutine_threadsafe(
-                        self.callback_registry['run_pattern'](file_path=f"{THETA_RHO_DIR}/{pattern_name}"),
+                        self.callback_registry['run_pattern'](
+                            file_path=f"{THETA_RHO_DIR}/{pattern_name}",
+                            clear_pattern=self.state.clear_pattern,
+                        ),
                         self.main_loop
                     ).add_done_callback(
                         lambda _: self._publish_pattern_state(None)  # Clear pattern after execution