Skip to content

feat: add controlDisplay and additionalNotification options - #113

Open
rejas wants to merge 1 commit into
developfrom
feat/control-display-and-notification
Open

feat: add controlDisplay and additionalNotification options#113
rejas wants to merge 1 commit into
developfrom
feat/control-display-and-notification

Conversation

@rejas

@rejas rejas commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Salvages the two features from the stale draft #67 and reimplements them on current develop.

Features

controlDisplay (default true) — do motion detection without touching the monitor. Setting it false is for "I want the motion events but I manage my display elsewhere". It gates all three monitor commands — INIT_MONITOR, ACTIVATE_MONITOR, DEACTIVATE_MONITOR — so MOTION_DETECTED and any additional notification still flow, but the display is never touched.

additionalNotification (default null) — broadcast a user-named notification to all modules whenever motion is detected, on the same frames as MOTION_DETECTED and carrying the same { score } payload. Point it at TAKE_SELFIE, SHOW_FRAME_1, whatever another module listens for.

Why this is a rebuild, not a rebase of #67

I looked at whether #67 could be salvaged directly. It can't — it is 34 commits behind and carries three real bugs plus staleness:

  • Dropped scoreThreshold from the engine init, so the configured threshold silently stopped applying (the engine fell back to its own default of 16) — while still logging it, which hid the regression.
  • Moved MOTION_DETECTED inside if (this.poweredOff), so it would only fire on wake from powered-off, silently breaking the contract for any listening module.
  • controlDisplay only guarded the deactivate — start and activate still fired, so controlDisplay: false gave you a mirror that switches on but never off.
  • Reintroduced the USER_PRESENCE handler and the dead socket MOTION_DETECTED that were removed in chore: remove the unreachable USER_PRESENCE handler #107 / fix: remove dead MOTION_DETECTED socket notification #96, sent the extra notification with an empty-string payload, and edited a README changelog section that no longer exists.

So I kept the two ideas and none of the implementation. The module change here is 8 lines.

Tests

Eight new tests across two describe blocks: default-off behaviour, the extra notification riding alongside MOTION_DETECTED, and that display-control-off still reports motion while sending no monitor commands. The four behavioural ones were verified to fail against the pre-feature module. Suite goes 69 → 77.

The test mock now also snapshots the notifications start() emits (startNotifications), so the INIT_MONITOR gating is testable without disturbing the existing post-start assertions.

Note on #67

Suggest closing #67 once this merges — it is superseded here. Happy to do that with a comment crediting the original idea.

🤖 Generated with Claude Code

Reimplements the two features from the stale draft in #67 on current develop.

controlDisplay (default true) lets the module do motion detection without
touching the monitor. When false it now gates all three monitor commands,
INIT_MONITOR, ACTIVATE_MONITOR and DEACTIVATE_MONITOR, not just the deactivate
the draft guarded, so it no longer leaves a mirror that switches on but never
off. MOTION_DETECTED and the display-independent state still flow.

additionalNotification (default null) broadcasts a user-named notification to
all modules on the same frames as MOTION_DETECTED, carrying the same
{ score } payload rather than the draft's empty string, so a listener like
TAKE_SELFIE gets the score too.

The draft is not salvageable as-is: it is 34 commits behind, reintroduces the
USER_PRESENCE handler and the dead socket MOTION_DETECTED that were since
removed, drops scoreThreshold from the engine init so the configured threshold
stopped taking effect, and moves MOTION_DETECTED inside the powered-off branch
so it only fired on wake. This rebuild keeps the ideas and none of that.

Tests cover both options, including that display control off still reports
motion and that the extra notification rides alongside MOTION_DETECTED. The
behavioural ones were verified to fail against the pre-feature module.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rejas
rejas force-pushed the feat/control-display-and-notification branch from 0f82f5d to c70bc05 Compare August 3, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant