Skip to content

Respect availability when reading standalone accessories - #496

Open
sidevesh wants to merge 1 commit into
ikalchev:devfrom
sidevesh:fix/standalone-accessory-availability
Open

sidevesh wants to merge 1 commit into
ikalchev:devfrom
sidevesh:fix/standalone-accessory-availability

Conversation

@sidevesh

@sidevesh sidevesh commented Oct 28, 2026 •

Copy link
Copy Markdown

Standalone accessory reads currently hardcode available = True, so an accessory whose available property returns False can still return stale characteristic values with a success status. Bridged accessories already respect this property.

Read self.accessory.available for the standalone accessory as well. An unavailable accessory then uses the existing SERVICE_COMMUNICATION_FAILURE response without a value, and successful reads resume when it becomes available again.

This addresses the library behavior underlying home-assistant/core#186542. The review there suggested handling availability in HAP-python: home-assistant/core#186542 (comment)

Regression coverage checks available and unavailable reads for both standalone and bridged accessories, ensures unavailable getters are not called, and verifies recovery.

Validation:

  • All four new parameterized cases pass. The unavailable standalone case fails against the original implementation.
  • Driver test module: 35 passed, 1 failed on local Python 3.14. The existing test_start_from_sync also fails on the unchanged baseline because asyncio.SafeChildWatcher was removed in Python 3.14. The repository CI matrix covers Python 3.9–3.13.
  • Scoped Ruff E/F checks and git diff --check pass.

Verified with HAP-python 5.0.0 patched in a Home Assistant 2026.10.4 container: after restarting Home Assistant, Apple Home displays the unavailable accessory as “No Response” instead of the stale power state.

@sidevesh
sidevesh marked this pull request as ready for review October 28, 2026 18:45
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