Scope automation switch to setpoints only, not the whole poll cycle
Master switch should behave like each zone's own auto_mode — NewBook polling, room-state tracking, and activity logging keep running as normal; only the actual device setpoint commands are held back. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
c6e3c73ead
commit
ab14d4dfe1
2 changed files with 9 additions and 9 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue