From 985e63bab2fc0f62b505eafa55228df34f4f5d4d Mon Sep 17 00:00:00 2001 From: legop3 Date: Mon, 6 Apr 2026 01:01:49 -0400 Subject: [PATCH] guhb --- server/src/services/roomHumanDetectionService.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/src/services/roomHumanDetectionService.js b/server/src/services/roomHumanDetectionService.js index 7082184f..66095668 100644 --- a/server/src/services/roomHumanDetectionService.js +++ b/server/src/services/roomHumanDetectionService.js @@ -8,6 +8,7 @@ const roverManager = require('./roverManager'); const { issueCommand } = require('./commandService'); const { publishEvent } = require('./eventBus'); const { sendAlert } = require('./alertService'); +const { getMode, MODES } = require('./modeManager'); const config = loadConfig(); const visionConfig = config.vision?.humanDetection || {}; @@ -55,6 +56,11 @@ let latestPositiveFrame = null; // { cameraId, confidence, ts, buffer } let cooldownUntil = 0; let hasClearedSinceLastDiscord = true; +function isDetectionActiveMode() { + const mode = getMode(); + return mode !== MODES.ADMIN && mode !== MODES.LOCKDOWN; +} + function ensureCameraState(cameraId) { if (!cameraState.has(cameraId)) { cameraState.set(cameraId, { @@ -135,6 +141,10 @@ function sendDiscordDetectionAlert(now) { } function evaluateEpisode(now = Date.now()) { + if (!isDetectionActiveMode()) { + markCleared(now); + return; + } if (episodeStartAt != null && lastAnyPositiveAt != null && now - lastAnyPositiveAt > CLEAR_WINDOW_MS) { markCleared(now); return; @@ -271,6 +281,7 @@ if (!startWorker()) { } roomCameraStreamEvents.on('frame', ({ id, buffer, ts }) => { + if (!isDetectionActiveMode()) return; if (!id || !buffer) return; submitFrame(String(id), buffer, ts); });