Skip to content

docs: document subscribe() callbacks and lock notifications#532

Draft
bluetoothbot wants to merge 1 commit into
sblibs:mainfrom
bluetoothbot:koan/doc-lock-subscribe-notifications
Draft

docs: document subscribe() callbacks and lock notifications#532
bluetoothbot wants to merge 1 commit into
sblibs:mainfrom
bluetoothbot:koan/doc-lock-subscribe-notifications

Conversation

@bluetoothbot

@bluetoothbot bluetoothbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

What: Add a README "Subscribing to state changes" section documenting the subscribe() callback API and how lock notifications surface real-time state.

Why: Open Question #489 asks how lock event subscription works — the mechanism (subscribe() → callback → unsubscribe, plus the connected-notification path for locks) is undocumented anywhere user-facing. New integrators have to read device.py/lock.py to discover it.

How: Documents the observable contract derived from the code: subscribe(callback) registers a zero-arg callback and returns an unsubscribe fn; callbacks fire after update() and on unsolicited notifications while connected; lock()/unlock() enable notifications for the operation window so manual operation during it fires the callback. Includes a runnable lock example.

Testing: Docs-only (Markdown). Example mirrors the existing WoLock snippets and the public accessors (subscribe, update, get_lock_status, unlock) as they exist on main.


Autonomous contribution by Kōan, on behalf of Nick (nick@openhomefoundation.org).


Quality Report

Changes: 1 file changed, 46 insertions(+)

Code scan: 1 issue(s) found

  • README.md:138 — debug print statement

Tests: passed (1300 passed)

Branch hygiene: clean

Generated by Kōan

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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