feat: add controlDisplay and additionalNotification options - #113
Open
rejas wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
feat/control-display-and-notification
branch
from
August 3, 2026 06:40
0f82f5d to
c70bc05
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Salvages the two features from the stale draft #67 and reimplements them on current
develop.Features
controlDisplay(defaulttrue) — do motion detection without touching the monitor. Setting itfalseis for "I want the motion events but I manage my display elsewhere". It gates all three monitor commands —INIT_MONITOR,ACTIVATE_MONITOR,DEACTIVATE_MONITOR— soMOTION_DETECTEDand any additional notification still flow, but the display is never touched.additionalNotification(defaultnull) — broadcast a user-named notification to all modules whenever motion is detected, on the same frames asMOTION_DETECTEDand carrying the same{ score }payload. Point it atTAKE_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:
scoreThresholdfrom 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.MOTION_DETECTEDinsideif (this.poweredOff), so it would only fire on wake from powered-off, silently breaking the contract for any listening module.controlDisplayonly guarded the deactivate — start and activate still fired, socontrolDisplay: falsegave you a mirror that switches on but never off.USER_PRESENCEhandler and the dead socketMOTION_DETECTEDthat 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 theINIT_MONITORgating 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