Skip to content

Add HapStatusError and answer setter failures with its status - #560

Closed
ikalchev wants to merge 1 commit into
refactor/callback-apifrom
refactor/hap-status-error
Closed

ikalchev wants to merge 1 commit into
refactor/callback-apifrom
refactor/hap-status-error

Conversation

@ikalchev

@ikalchev ikalchev commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #562 (the callback interface APIs). Makes the driver's write path answer HapStatusError, the first piece of the new interface to be dispatched.

What

  • A characteristic setter that raises HapStatusError answers the controller with its status — sync and coroutine setters alike; other characteristics of the request keep their own results.
  • A service or accessory setter that raises it answers for all of its characteristics in the request.
  • Any other exception keeps answering -70402 (unchanged).
  • advanced/async.rst documents the protocol with an example.

Closes #75 for characteristic, service and accessory level setters. The getter side follows in #561; the curated status set is defined by pyhap.errors (reviewed in #562).

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.05%. Comparing base (09c4c3a) to head (df8cde0).

Additional details and impacted files
@@                    Coverage Diff                    @@
##           refactor/callback-api     #560      +/-   ##
=========================================================
+ Coverage                  92.04%   92.05%   +0.01%     
=========================================================
  Files                         54       54              
  Lines                      10900    10914      +14     
  Branches                    1407     1407              
=========================================================
+ Hits                       10033    10047      +14     
  Misses                       579      579              
  Partials                     288      288              
Files with missing lines Coverage Δ
pyhap/accessory_driver.py 94.24% <100.00%> (+0.11%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ikalchev
ikalchev force-pushed the refactor/hap-status-error branch from ddf1d1d to 059c3f8 Compare November 13, 2026 13:02
@ikalchev
ikalchev changed the base branch from docs/callback-refactor-design to refactor/callback-api November 13, 2026 13:03
Comment thread CHANGELOG.md Outdated
per-connection state from leaking to a reused client address. The driver
does not dispatch them yet; the write and read pipelines adopt them in the
following releases of the refactor.
- Callbacks can answer a HAP status instead of the generic -70402: a setter

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop the changelog changes for now

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped — also from the third PR of the stack, so the changelog entries return with the finished design.

A setter that raises HapStatusError now answers the controller with its
status instead of the generic -70402, at every callback level: a
characteristic's setter answers for itself, a service or accessory
setter for all of its characteristics in the request. A coroutine
setter that raises it answers the same way once it is done, so a
refusal is reported whether the callback is sync or async, and other
characteristics of the request keep their own results.

Closes #75 for characteristic, service and accessory level setters.
@ikalchev
ikalchev force-pushed the refactor/callback-api branch from f902694 to 09c4c3a Compare November 13, 2026 14:41
@ikalchev
ikalchev force-pushed the refactor/hap-status-error branch from 059c3f8 to df8cde0 Compare November 13, 2026 14:41
@ikalchev

Copy link
Copy Markdown
Owner Author

Closing per maintainer decision — continuing locally; the work continues on local branches and will return as PRs when the design settles.

@ikalchev ikalchev closed this Nov 13, 2026
@ikalchev
ikalchev deleted the refactor/hap-status-error branch November 13, 2026 20:18
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