Repository navigation
feat: add a Yale Access Bluetooth (yalexs_ble) provider - #1855
drgreenbaum wants to merge 3 commits into
Conversation
Manages keypad PINs on Yale and August locks through the Yale Access Bluetooth integration's keypad credential actions (home-assistant/core#185596): set_lock_credential, clear_lock_credential and get_lock_credential_status. PINs are write-only through those actions, so occupied slots read as unreadable and empty slots as empty, as for Schlage. Code uses come from the yalexs_ble_lock_activity bus event: a keypad unlock with a slot is recorded as that slot's PIN being used; manual operations, the keypad's lock button and the master code record nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KQD9t6v8C3VpjfDu7jZNKN
raman325
left a comment
There was a problem hiding this comment.
Thanks for this — a Yale Access Bluetooth provider is a welcome addition. Inline comments below; the first three are behavior bugs worth fixing before merge (missing per_exchange_budget, activity events dropped for the secure-mode lock entity, stale names on nameless sets), the rest are nits.
One more nit that has no line to anchor to: per AGENTS.md, please add yalexs_ble.py to the Providers System list there, and add tests/providers/yalexs_ble/test_e2e.py (step 8 lists conftest.py, test_provider.py, test_e2e.py for every provider — Schlage's fake service is a good model).
🤖 Generated with Claude Code
- Declare per_exchange_budget (300 s): the provider reads one slot per Bluetooth keycode exchange, and yalexs-ble retries an operation up to four times, each a connect plus up to three 10 s response waits. - Clear the slot before a nameless set, so the integration forgets the previous holder's name (set_lock_credential stores a name only when given). - Hard refresh reads the managed slots plus the slots asked for. - Match activity events on the lock's device, not the entity id: the integration fires them for its main lock entity, also when the provider manages the secure-mode lock entity of the same lock. - Tests: core's real errors (pin_already_in_use, communication_error), the nameless set, device matching, hard refresh, budget; a stateful fake of the credential actions and test_e2e.py (setup writes and sync, a PIN change, a refusal that disables the slot once, a keypad unlock recorded as the user's). - AGENTS.md: list yalexs_ble.py among the providers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KQD9t6v8C3VpjfDu7jZNKN
|
Thanks for the thorough review. Everything is addressed in f7598b5, committed forward:
Tests: 🤖 Generated with Claude Code |
The Smart Code Handle (model CERES) keeps user PINs in slots 1-99 (its master code is slot 0) and refuses KEYCODE_COMMIT for slot 100 and up with NACK 0x3B, found by writing slots on the device. Report that capacity for the model, read from the device registry, so slot allocation never picks a slot the handle refuses; other models keep the 250 the integration validates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KQD9t6v8C3VpjfDu7jZNKN
|
One more forward commit, 5d3d1a2: the Yale Smart Code Handle ( |
raman325
left a comment
There was a problem hiding this comment.
Thanks for the quick and thorough follow-up. I checked every fix against core#185596 and they all hold up: the event does carry ATTR_DEVICE_ID, _clear_credential drops the stored name, and two 300 s exchanges still fit the flat 600 s write timeout. Keeping TestNativeTransportContract is fine.
One question inline about the clear-first path. Otherwise this looks ready.
🤖 Generated with Claude Code
| if name: | ||
| data["name"] = name | ||
| async with self._serialize_sequence(): | ||
| if not name: |
There was a problem hiding this comment.
Question: this now runs clear_keycode on slots that may already be empty, e.g. the first write to a fresh slot. Does a Yale lock accept clearing an empty slot? If it NACKs that (the way the Smart Code Handle NACKs slot 100+), core raises communication_error and every nameless set to an unused slot fails before the set runs. If you can try a nameless set on an empty slot on your hardware, that settles it. If it does reject, catching that specific refusal and going on to the set would keep the fix.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1855 +/- ##
==========================================
- Coverage 98.91% 98.90% -0.02%
==========================================
Files 73 74 +1
Lines 10357 10469 +112
Branches 599 599
==========================================
+ Hits 10245 10354 +109
- Misses 112 115 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Proposed change
Adds a provider for Yale Access Bluetooth (
yalexs_ble), so Lock Code Manager can manage keypad PINs on Yale/August locks over local Bluetooth, without the Yale cloud or a bridge.It uses the keypad credential actions proposed in home-assistant/core#185596 (named and shaped like the Matter lock credential actions):
yalexs_bleactionset_lock_credential(credential_type: pin,credential_data,credential_index,name)clear_lock_credential(afterget_lock_credential_statusshows it occupied)get_lock_credential_status→credential_existsSlotCredential.unreadable()and empty ones asempty(), the same model as Schlage.yalexs_ble_lock_activitywhen the lock's activity log shows an operation. A keypad unlock with a slot (source: pin,slot: N) is recorded throughasync_fire_code_slot_event. Manual operations, the keypad's lock button (slot: None) and the master code record nothing.INTEGRATIONS_CLASS_MAP,yalexs_bleis added toafter_dependencies, and there is a README row with a footnote pointing at the core PR.Status of the dependency: home-assistant/core#185596 is not merged yet, so on a stock Home Assistant release the actions don't exist and the provider can't do anything. I'm opening this as a draft so it is ready when the core PR lands. It is happy to wait.
Tested on hardware (HA 2026.11.3 with #185596 installed as a custom integration): a Yale Doorman L3 (Yale Access module
MD-02) and a Yale Smart Code Handle (CERES), both always connected. I created users from the config flow and the dashboard strategy, sync went green, the codes work at the keypads, andcredential_usedevents fire with the right user. (The handle additionally needs Yale-Libs/yalexs-ble#448 for its keypad credential type.)Type of change
Additional information
Tests:
tests/providers/yalexs_ble/(26 tests: shared connection and native-transport mixins, occupancy, set/clear, refusal →CodeRejectedError, malformed status, activity-event attribution and listener lifecycle). The full suite passes locally: 3668 passed, 2 skipped, 2 xfailed.ruff check/ruff format --checkare clean.🤖 Generated with Claude Code