Skip to content

zwave lock: make sync codes more robust, add it to refresh handling - #3339

Merged
ctowns merged 3 commits into
mainfrom
zwave-lock/harden-sync-codes
Nov 13, 2026
Merged

ctowns merged 3 commits into
mainfrom
zwave-lock/harden-sync-codes

Conversation

@hcarter-775

@hcarter-775 hcarter-775 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Description of Change

Attempt a re-sync of lock codes after migration is completed as a backup measure, in case our local lockCodes cache missed. Also, retry lock codes migration on every driver init, until the sync has actually completed at least once. Finally, include code syncing in refresh to allow users some retry functionality in the case that something fails.

Summary of Completed Tests

Tests updated. Tested on a Yale lock with a fresh onboard.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Channel deleted.

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

zwave-lock_coverage.xml

File Coverage
All files 90% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/zwave-alarm-v1-lock/init.lua 89% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_handlers/capabilities.lua 96% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_handlers/zwave_responses.lua 85% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/samsung-lock/init.lua 87% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/keywe-lock/init.lua 77% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/schlage-lock/init.lua 98% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/schlage-lock/init.lua 95% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/legacy-handlers/samsung-lock/init.lua 94% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/zwave-alarm-v1-lock/init.lua 24% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/init.lua 97% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lazy_load_subdriver.lua 57% ❌
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_utils/tables.lua 98% ✅
/home/runner/work/SmartThingsEdgeDrivers/SmartThingsEdgeDrivers/drivers/SmartThings/zwave-lock/src/lock_utils/utils.lua 96% ✅

Minimum allowed coverage is 90%

Generated by 🐒 cobertura-action against 65f06c8

@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Test Results

   73 files    571 suites   0s ⏱️
3 405 tests 3 405 ✅ 0 💤 0 ❌
5 451 runs  5 451 ✅ 0 💤 0 ❌

Results for commit 65f06c8.

♻️ This comment has been updated with latest results.

@ctowns
ctowns force-pushed the zwave-lock/harden-sync-codes branch from e6cd227 to 6aa1ce1 Compare November 12, 2026 16:47
@ctowns

ctowns commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Rebased changes. Made a few small updates to match the zigbee equivalent changes in #3330 , but they were mostly already the same. Claude found a bug in AI review that I added a patch for, but otherwise the original two commits are unchanged.

@hcarter-775 hcarter-775 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannot approve my own pr, but @ctowns I approve the changes made- I have checked that they are 1-1 with the Zigbee logic, altered of course to fit the Zwave particularities.

Base automatically changed from zwave-lock/standardize-cred-user-management to main November 13, 2026 18:49
hcarter-775 and others added 3 commits November 13, 2026 12:52
Match the zigbee-lock sync handling merged in #3330.

During a code sync, user_code_report compared the reported user ID
status, rather than its user identifier, against the expected code
index, so a report for a different slot was taken as the result for
the current one. A late or duplicate report could record an occupied
code at the wrong slot and skip the slot actually being checked.

- A report for an index below the current one has already been
  processed: log it and return without advancing the sync.
- A report for any other unexpected index is logged and treated as an
  unoccupied slot, so the sync continues.
- add_reported_credential returns the result of the add, as in
  zigbee-lock.

Adds tests for both cases, and ports the zigbee-lock tests for
persisting the sync index, clearing the unoccupied counter on
completion, and retrying a stalled sync after the busy window expires.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ctowns
ctowns force-pushed the zwave-lock/harden-sync-codes branch from 6aa1ce1 to 65f06c8 Compare November 13, 2026 19:13
@ctowns

ctowns commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Rebased due to conflicts, but the changes were either due to command ordering or test cases, no functional conflicts

@ctowns
ctowns merged commit 4702320 into main Nov 13, 2026
22 checks passed
@ctowns
ctowns deleted the zwave-lock/harden-sync-codes branch November 13, 2026 19:21
hcarter-775 added a commit that referenced this pull request Nov 13, 2026
This reverts commit 91a7498.

Conflicts with later changes (#3337, #3339, #3346) in the zwave-lock
tests were resolved by dropping the tests added by #3323 and keeping
the lock_utils require and Schlage mock device that remaining code
and tests still use.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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