diff --git a/backend/src/lib/scheduler.js b/backend/src/lib/scheduler.js index 0a8b5f1..223efa9 100644 --- a/backend/src/lib/scheduler.js +++ b/backend/src/lib/scheduler.js @@ -148,11 +148,10 @@ async function saveZoneState(zoneId, roomState, bookingStatus) { // One poll cycle: fetch bookings once, walk every active room zone, apply heating // logic only where the room's state has actually changed since the last cycle. export async function pollOnce() { - // Master kill switch — overrides every zone's own auto_mode. Off means a full - // pause: no NewBook fetch, no state tracking, no device commands. Deliberately - // silent (no activity_log entry) since "paused" is a normal standing state, not - // an event — the Settings toggle itself is the record of when it changed. - if (!(await getConfig('automation_enabled', true))) return + // Master switch — same effect as every zone's own auto_mode, just applied stack-wide: + // NewBook fetch, room-state tracking and activity logging all keep running as normal, + // only the actual device setpoint commands are skipped. + const automationEnabled = await getConfig('automation_enabled', true) const defaults = { default_arrival_time: await getConfig('default_arrival_time', '15:00:00'), @@ -212,7 +211,7 @@ export async function pollOnce() { await saveZoneState(zone.id, newState, booking?.booking_status || null) - if (!zone.auto_mode) continue // manual override in effect — don't touch setpoints + if (!zone.auto_mode || !automationEnabled) continue // manual override or master switch off — don't touch setpoints if (newState === oldState) continue // no transition — never poll-and-reassert await applyStateTransition(zone, oldState, newState) diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx index 2399334..427dc24 100644 --- a/frontend/src/pages/Settings.tsx +++ b/frontend/src/pages/Settings.tsx @@ -95,7 +95,7 @@ export default function Settings() { try { await updateConfig('automation_enabled', next) setAutomationEnabled(next) - setMsg(next ? 'Automation resumed' : 'Automation paused — no setpoints will be sent to any device until resumed') + setMsg(next ? 'Automation resumed' : 'Automation paused — device setpoints will no longer change until resumed') setTimeout(() => setMsg(''), 4000) } catch (e) { setError(e instanceof Error ? e.message : 'Failed to update automation state') @@ -155,8 +155,9 @@ export default function Settings() { {automationEnabled ? 'Automation is ON' : 'Automation is PAUSED'}
- Master switch for every zone — overrides each zone's own auto mode. While paused, the scheduler - skips its poll entirely: no NewBook fetch, no state tracking, no setpoints sent to any device. + Master switch for every zone — overrides each zone's own auto mode. While paused, NewBook polling, + room-state tracking and activity logging all keep running as normal — only setpoint changes to + TRVs/aircon devices are skipped.