feat: countdown rule fires only when device matches configured condition

Countdown is now state-change-driven (no scheduled window):
- 'If turns ON → auto-OFF after duration' (on_to_off)
- 'If turns OFF → auto-ON after duration' (off_to_on)
Scheduler polls device state; timer only starts when state matches
the chosen condition. Cancels any pending timer if state changes again.
Away Mode startAction/endAction already wired; _stopAwayLoop uses endAction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
SRS IT
2026-03-28 22:24:11 -04:00
parent 5024996523
commit e52b3578dc
3 changed files with 67 additions and 31 deletions
@@ -399,10 +399,10 @@
<input type="number" id="dwm-countdown-mins" min="1" max="1440" placeholder="60" />
</div>
<div class="form-group">
<label>Action when timer fires</label>
<label>Condition</label>
<select id="dwm-countdown-action">
<option value="1">Turn ON</option>
<option value="0">Turn OFF</option>
<option value="on_to_off">If device turns ON → auto-OFF after duration</option>
<option value="off_to_on">If device turns OFF → auto-ON after duration</option>
</select>
</div>
</div>