Repository navigation
Add list_locks() to the provider contract - #23
Merged
Merged
Conversation
Operators configuring rooms need each lock's vendor-side id next to its
human-readable name. Add an optional list_locks() to BaseLockProvider that
returns [{"id", "name"}, ...]; the default raises NotImplementedError so a
caller can detect vendors that don't expose a listing.
Implemented and verified per vendor:
- TESA: wraps find_all_rooms() (door_id + door_name) — the only way to see
the internal door_id, hidden in the Smartair UI.
- TTLock: pages through /v3/lock/list (lockId + lockAlias).
- Omnitec: GET /lock/list (TTLock-shaped {"list":[{lockId,lockAlias}]}),
verified against the live Rent&Pass account (286 locks).
- Salto: GET /v1.2/sites/{site_id}/locks; the lock has no plain "name", so
the label is customer_reference (as for roles). Verified against the live
Salto KS account.
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.
What
Adds an optional
list_locks()toBaseLockProviderreturning[{"id", "name"}, ...]— each lock's vendor-side identifier next to its human-readable name — so an operator configuring rooms can read the id to store without digging through the vendor backend.The default raises
NotImplementedError, so a caller can detect (and gracefully handle) vendors that don't expose a listing. The Odoo side (roomdoo-modules) catches it to show a friendly message.Per vendor
find_all_rooms()door_id/door_name/v3/lock/list(paged)lockId/lockAlias/lock/listlockId/lockAlias/v1.2/sites/{site_id}/locksid/customer_referenceSalto note: the lock object has no plain
name; its readable label iscustomer_reference(as for roles) — confirmed against the live API, where mappingnamewould otherwise returnNone.Tests
111 passing (+5: one per vendor mapping, plus a base-level test that the default raises
NotImplementedError).