Skip to content

Add list_locks() to the provider contract - #23

Merged
jesusVMayor merged 1 commit into
mainfrom
feat/list-locks
Jun 19, 2026
Merged

jesusVMayor merged 1 commit into
mainfrom
feat/list-locks

Conversation

@jesusVMayor

Copy link
Copy Markdown
Member

What

Adds an optional list_locks() to BaseLockProvider returning [{"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

Vendor Endpoint id / name fields Verified
TESA find_all_rooms() door_id / door_name live (real Smartair)
TTLock /v3/lock/list (paged) lockId / lockAlias docs + unit test
Omnitec /lock/list lockId / lockAlias live (Rent&Pass, 286 locks)
Salto /v1.2/sites/{site_id}/locks id / customer_reference live (Salto KS)

Salto note: the lock object has no plain name; its readable label is customer_reference (as for roles) — confirmed against the live API, where mapping name would otherwise return None.

Tests

111 passing (+5: one per vendor mapping, plus a base-level test that the default raises NotImplementedError).

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.
@jesusVMayor
jesusVMayor merged commit 11343de into main Jun 19, 2026
2 checks passed
@jesusVMayor
jesusVMayor deleted the feat/list-locks branch June 19, 2026 20:25
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