Skip to content

feat: add support for capabilities endpoint#306

Merged
bdraco merged 11 commits intomainfrom
cap
Sep 16, 2025
Merged

feat: add support for capabilities endpoint#306
bdraco merged 11 commits intomainfrom
cap

Conversation

@bdraco
Copy link
Member

@bdraco bdraco commented Sep 16, 2025

Summary

Implements fetching device capabilities from the Yale API to properly detect which locks support unlatch functionality.

Background

Previously, unlatch support was determined solely by device Type/model numbers, which was incomplete and caused locks to incorrectly open doors when users only wanted to unlock them (home-assistant/core#127588).

Changes

  • Added /devices/capabilities API endpoint support for Yale brands
  • Created TypedDict definitions for type-safe capability responses
  • Modified LockDetail.unlatch_supported to check capabilities first, falling back to Type-based detection
  • Fetch capabilities sequentially at startup (only for Yale Global/Yale Home brands)
  • Handle 404/409 errors gracefully for older devices that don't support capabilities
  • Clear cached properties when capabilities are updated
  • Fixed exception handling to catch YaleApiError instead of ClientResponseError

Key Benefits

  • Accurately detects which locks support unlatch vs simple unlock
  • Fixes issue where "unlock" incorrectly opened doors on some Yale locks
  • Maintains backward compatibility with Type-based detection and August brands
  • Type-safe implementation with proper error handling

@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2025

Codecov Report

❌ Patch coverage is 96.87500% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
yalexs/manager/data.py 88.88% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@bdraco bdraco merged commit 9ce477a into main Sep 16, 2025
9 checks passed
@bdraco bdraco deleted the cap branch September 16, 2025 20:42
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.

2 participants

Comments