-
Notifications
You must be signed in to change notification settings - Fork 523
[Aqara/Locks] Improvement of credential info management #2712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[Aqara/Locks] Improvement of credential info management #2712
Conversation
Test Results 71 files 480 suites 0s ⏱️ Results for commit 478df5e. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 478df5e |
|
linter fail |
I have removed the whitespace. |
| local HOST_COUNT = "__host_count" | ||
| local PERSIST_DATA = "__persist_area" | ||
|
|
||
| credential_utils.attrCopy = function(table) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is an unnecessary function. utils.deep_copy is already doing this recursively for the whole table.
|
|
||
| device:set_field(HOST_COUNT, host_cnt, { persist = true }) | ||
| credential_utils.save_data(driver) | ||
| credential_utils.backup_data(device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should re-order this so that backup_data done before the credential_utils.save_data. This will cause the backed up state to be persisted after it is updated.
| local credentialInfoTable = device:get_field(PERSIST_DATA) | ||
| if credentialInfoTable ~= nil then | ||
| device:emit_event(lockCredentialInfo.credentialInfo(credentialInfoTable, { visibility = { displayed = false } })) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be an else clause where we call backup_data in the case that there is nothing persisted? I think this will help ensure existing devices have the state for this capability persisted.
Check all that apply
Type of Change
Checklist
Description of Change
Summary of Completed Tests