Skip to content

Matter lock: Update embedded cluster definitions and drop alias uses - #3388

Open
hcarter-775 wants to merge 3 commits into
mainfrom
matter-lock/update-embedded-cluster
Open

hcarter-775 wants to merge 3 commits into
mainfrom
matter-lock/update-embedded-cluster

Conversation

@hcarter-775

Copy link
Copy Markdown
Contributor

Description of Change

Older hubs are crashing in matter-lock with:

Referenced unknown attribute AliroReaderVerificationKey on cluster DoorLock

Hub Lua libraries didn't get the Aliro DoorLock attributes until api 11 (v11_hc0.54.x); the api-10 libraries (v10_hc0.53.x) don't have them. The driver only used its embedded DoorLock cluster when version.api < 10, so api-10 hubs fell back to their own DoorLock definition and errored on the first Aliro attribute lookup during subscribe.

Changes:

  • Version check: use the embedded DoorLock cluster when version.api < 11 (was < 10), in init.lua and lock_sync.lua.
  • Regenerated embedded DoorLock from the current scripting-engine codegen:
    • adds definitions that were previously listed in the cluster maps but had no file, including AliroSupportedBLEUWBProtocolVersions (which the driver subscribes to) and UnboltDoor
    • picks up recent codegen fixes (nil-safe elements, SetCredential.credential_data as OctetString2)
  • Canonical type names: the driver used Matter 1.2 alias names (DlAlarmCode, DlCredentialType, DoorLockFeature.PIN_CREDENTIALS, ...), which only resolve through the hub's alias tables. Without aliases in the embedded cluster, those would fail on api < 11, so they are replaced with the canonical names (AlarmCodeEnum, CredentialTypeEnum, Feature.PIN_CREDENTIAL, ...). Values are unchanged.
  • api-9 battery fix: handle_battery_charge_level uses PowerSource.types.BatChargeLevel on api < 10, where BatChargeLevelEnum doesn't exist.
  • Tests: apply the same embedded DoorLock swap for api < 11 and use the canonical type names.

Summary of Completed Tests

  • All 188 matter-lock unit tests pass against current (api 22) lua_libs.
  • With the regenerated embedded cluster, all 188 tests also pass when forced to version.api = 10, so they exercise the embedded DoorLock path end to end, including the Aliro tests.
  • Ran against the published api-9 (0.52) lua_libs: tests load and run, but most fail on test-harness lifecycle differences (api 9 subscribes on added/doConfigure rather than init), not on driver errors.

hcarter-775 and others added 3 commits December 1, 2026 13:37
- Swap in the embedded `DoorLock` cluster for api < 11, matching driver
- Use canonical type names instead of Matter 1.2 aliases
- Select `BatChargeLevel` vs `BatChargeLevelEnum` by api version

Co-Authored-By: Claude <claude@anthropic.com>
- Regenerate from current codegen without `lazy_require`
- Keep only attributes, commands, events and types the driver uses
- Add missing Aliro attribute and `UnboltDoor` definitions
- Strip comments and alias support

Co-Authored-By: Claude <claude@anthropic.com>
- Hub libs before api 11 lack Aliro attributes, crashing on
  `AliroReaderVerificationKey` lookups; use embedded cluster instead
- Replace alias type names with canonical names available everywhere
- Handle `BatChargeLevel` naming on api 9 hubs

Co-Authored-By: Claude <claude@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

matter-lock_coverage.xml

File Coverage
All files 91% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/init.lua 90% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/lock_sync.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/lazy_load_subdriver.lua 57% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/lock_utils.lua 89% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/matter-lock/src/unmigrated-matter-lock/init.lua 91% ✅

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 7f13855

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Test Results

   73 files    575 suites   0s ⏱️
3 519 tests 3 517 ✅ 0 💤 2 ❌
5 569 runs  5 567 ✅ 0 💤 2 ❌

For more details on these failures, see this check.

Results for commit 7f13855.

♻️ This comment has been updated with latest results.

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