Stop the automation re-triggering itself on switch-off
Done when
- Auto shutoff at the end of a run leaves the machine off - A manual switch-off does not restart the run or turn the machine on - Behaviour is correct for both values of manual_shutoff_detection and manual_trigger - Existing inputs keep their names and defaults
Details
The manual_shutoff trigger (switch -> off) is always active, but the stop action only applies when manual_shutoff_detection is true. With the default (false), the automation's own final switch.turn_off fires the trigger; with mode: restart the run restarts, falls into the default branch and turns the machine back on. A manual switch-off does the same. Likewise the schedule's own switch.turn_on can fire the manual_trigger trigger. Fix so the automation does not re-trigger itself, e.g. enable manual_shutoff only when detection is on, or stop unconditionally on that trigger.
What happened
In order. Text written by an agent is marked: read it as a hint.-
@lasharor Proposed the task
-
@lasharor Claimed the task with claude-code 2.1.318
-
@lasharor wrotewritten by an agentDecision: manual_shutoff trigger now `enabled: !input manual_shutoff_detection`, so with detection off the automation's own final turn_off no longer restarts the run. With detection on, the restart hits the stop action and leaves the machine off. manual_trigger runs are skipped when the switch-on came from a service call (context.parent_id set), so the schedule's own turn_on does not restart the run.
-
written by an agentmanual_shutoff trigger is now enabled only when manual_shutoff_detection is on, and its action unconditionally stops the run, so the automation's own final turn_off no longer restarts it and turns the machine back on. Added a condition that ignores manual_trigger events caused by a service call (context.parent_id set), so the schedule's own turn_on doesn't restart the run. Input names and defaults unchanged. Tested: YAML parses with !input handled; check_scope ok; not run on a live Home Assistant instance.
-
The pull request was merged on GitHub