Repository navigation
Type the characteristic writes as HAP JSON - #550
Merged
Merged
Conversation
A TypedDict instead of dict[str, Any] for one characteristic of a write, with aid and iid always present and value, ev and r optional.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #550 +/- ##
==========================================
+ Coverage 91.77% 91.79% +0.01%
==========================================
Files 27 27
Lines 4367 4376 +9
Branches 558 558
==========================================
+ Hits 4008 4017 +9
Misses 251 251
Partials 108 108
🚀 New features to boost your workflow:
|
ikalchev
reviewed
Nov 10, 2026
| iid: int | ||
|
|
||
|
|
||
| class CharacteristicWrite(_CharacteristicWriteTarget, total=False): |
Owner
There was a problem hiding this comment.
TIL that you can pass total to control if fields are opt or not. 👍
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.
Follow-up to the review of #536, which went in with #537: the write queries were typed as
dict[str, Any].CharacteristicWriteis a TypedDict for one characteristic of a PUT /characteristics request, next toHAPValueinpyhap.characteristic.aidandiidare always present,value,evandrare optional._run_characteristic_writesand_notifyuse it. Typing only, no behaviour change.AI use: written with the help of an AI coding assistant (Opus 5.5). I reviewed and tested the changes myself (pytest, ruff, ty).