From 502499652325b69736d859c1654f6edcbcf81dca Mon Sep 17 00:00:00 2001 From: SRS IT Date: Sat, 28 Mar 2026 22:17:14 -0400 Subject: [PATCH] fix: simplify countdown action to plain Turn ON / Turn OFF, no auto-reverse --- .../homebridge-plugin/homebridge-ui/public/index.html | 4 ++-- packages/homebridge-plugin/homebridge-ui/public/index.js | 2 +- packages/homebridge-plugin/lib/scheduler.js | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/homebridge-plugin/homebridge-ui/public/index.html b/packages/homebridge-plugin/homebridge-ui/public/index.html index c0a5207..5c130d3 100644 --- a/packages/homebridge-plugin/homebridge-ui/public/index.html +++ b/packages/homebridge-plugin/homebridge-ui/public/index.html @@ -401,8 +401,8 @@
diff --git a/packages/homebridge-plugin/homebridge-ui/public/index.js b/packages/homebridge-plugin/homebridge-ui/public/index.js index 42c1407..2ec11fa 100644 --- a/packages/homebridge-plugin/homebridge-ui/public/index.js +++ b/packages/homebridge-plugin/homebridge-ui/public/index.js @@ -196,7 +196,7 @@ function dwmRuleSummary(r) { } if (r.type === 'Countdown') { const mins = r.countdownTime ? Math.round(r.countdownTime / 60) : null; - const action = r.countdownAction === 0 ? 'OFF → auto-ON' : 'ON → auto-OFF'; + const action = r.countdownAction === 0 ? 'Turn OFF' : 'Turn ON'; return mins ? `⏱ ${mins} min · ${action}` : '—'; } const days = dayLabel(r.days); diff --git a/packages/homebridge-plugin/lib/scheduler.js b/packages/homebridge-plugin/lib/scheduler.js index 29bafac..0f851f8 100644 --- a/packages/homebridge-plugin/lib/scheduler.js +++ b/packages/homebridge-plugin/lib/scheduler.js @@ -219,20 +219,12 @@ class DwmScheduler { if (windowStart < 0 || !(rule.windowDays?.length)) continue; const countdownAction = Number(rule.countdownAction ?? 1); - const countdownEnd = countdownAction === 1 ? 0 : 1; // opposite of start - const crossesMidnight = windowEnd >= 0 && windowEnd < windowStart; for (const dayId of rule.windowDays) { for (const td of (rule.targetDevices ?? [])) { if (!td.host || !td.port) continue; schedule.push({ ruleId: rule.id, ruleName: rule.name, targetHost: td.host, targetPort: td.port, dayId: Number(dayId), targetSecs: windowStart, action: countdownAction }); - if (windowEnd >= 0) { - const offDayId = crossesMidnight ? (Number(dayId) % 7) + 1 : Number(dayId); - schedule.push({ ruleId: rule.id + '-wend', ruleName: rule.name, - targetHost: td.host, targetPort: td.port, - dayId: offDayId, targetSecs: windowEnd, action: countdownEnd }); - } } } continue;