-
Notifications
You must be signed in to change notification settings - Fork 466
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
Add Dynamic Battery Support for Base-Lock Profiled Door Lock Devices #1660
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
518b4a2
initial: add do configure logic and edit fingerprint
hcarter-775 5b60ef2
add: logic to not configure wwst devices
hcarter-775 e255c96
remove: unused capability definition
hcarter-775 cebeaf4
add: newest fingerprint device
hcarter-775 43a966d
implement: check for capabilities of base-lock
hcarter-775 b3c94b3
add: new profile, updated battery check logic
hcarter-775 ed1dd1b
add: info_changed event
hcarter-775 e0179b2
fix test, remove aqara references
hcarter-775 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
drivers/SmartThings/matter-lock/profiles/base-lock-nobattery.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: base-lock-nobattery | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: lock | ||
version: 1 | ||
config: | ||
values: | ||
- key: "lock.value" | ||
enabledValues: | ||
- locked | ||
- unlocked | ||
- not fully locked | ||
- id: lockCodes | ||
version: 1 | ||
- id: tamperAlert | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: SmartLock |
21 changes: 21 additions & 0 deletions
21
drivers/SmartThings/matter-lock/profiles/lock-without-codes-nobattery.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: lock-without-codes-nobattery | ||
components: | ||
- id: main | ||
capabilities: | ||
- id: lock | ||
version: 1 | ||
config: | ||
values: | ||
- key: "lock.value" | ||
enabledValues: | ||
- locked | ||
- unlocked | ||
- not fully locked | ||
- id: tamperAlert | ||
version: 1 | ||
- id: firmwareUpdate | ||
version: 1 | ||
- id: refresh | ||
version: 1 | ||
categories: | ||
- name: SmartLock |
This file contains 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
99 changes: 99 additions & 0 deletions
99
drivers/SmartThings/matter-lock/src/test/test_bridged_matter_lock.lua
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
-- Copyright 2024 SmartThings | ||
-- | ||
-- Licensed under the Apache License, Version 2.0 (the "License"); | ||
-- you may not use this file except in compliance with the License. | ||
-- You may obtain a copy of the License at | ||
-- | ||
-- http://www.apache.org/licenses/LICENSE-2.0 | ||
-- | ||
-- Unless required by applicable law or agreed to in writing, software | ||
-- distributed under the License is distributed on an "AS IS" BASIS, | ||
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
-- See the License for the specific language governing permissions and | ||
-- limitations under the License. | ||
|
||
local test = require "integration_test" | ||
test.add_package_capability("lockAlarm.yml") | ||
local t_utils = require "integration_test.utils" | ||
local clusters = require "st.matter.clusters" | ||
|
||
local mock_device_record = { | ||
profile = t_utils.get_profile_definition("base-lock.yml"), | ||
manufacturer_info = {vendor_id = 0, product_id = 0}, | ||
endpoints = { | ||
{ | ||
endpoint_id = 2, | ||
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
}, | ||
device_types = { | ||
device_type_id = 0x0016, device_type_revision = 1, -- RootNode | ||
} | ||
}, | ||
{ | ||
endpoint_id = 10, | ||
clusters = { | ||
{cluster_id = clusters.DoorLock.ID, cluster_type = "SERVER", feature_map = 0x0101}, | ||
}, | ||
}, | ||
}, | ||
} | ||
local mock_device = test.mock_device.build_test_matter_device(mock_device_record) | ||
|
||
local mock_device_record_aqara = { | ||
profile = t_utils.get_profile_definition("lock-lockalarm-nobattery.yml"), | ||
manufacturer_info = {vendor_id = 0x115F, product_id = 0x2801}, -- Aqara Smart Lock U300 | ||
endpoints = { | ||
{ | ||
endpoint_id = 2, | ||
clusters = { | ||
{cluster_id = clusters.Basic.ID, cluster_type = "SERVER"}, | ||
}, | ||
device_types = { | ||
device_type_id = 0x0016, device_type_revision = 1, -- RootNode | ||
} | ||
}, | ||
{ | ||
endpoint_id = 10, | ||
clusters = { | ||
{cluster_id = clusters.DoorLock.ID, cluster_type = "SERVER", feature_map = 0x0000}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
local mock_device_aqara = test.mock_device.build_test_matter_device(mock_device_record_aqara) | ||
|
||
local function test_init() | ||
local subscribe_request = clusters.DoorLock.attributes.LockState:subscribe(mock_device) | ||
subscribe_request:merge(clusters.DoorLock.events.DoorLockAlarm:subscribe(mock_device)) | ||
subscribe_request:merge(clusters.DoorLock.events.LockOperation:subscribe(mock_device)) | ||
subscribe_request:merge(clusters.DoorLock.events.LockUserChange:subscribe(mock_device)) | ||
test.socket["matter"]:__expect_send({mock_device.id, subscribe_request}) | ||
test.mock_device.add_test_device(mock_device) | ||
|
||
local subscribe_request = clusters.DoorLock.attributes.LockState:subscribe(mock_device_aqara) | ||
subscribe_request:merge(clusters.DoorLock.events.DoorLockAlarm:subscribe(mock_device_aqara)) | ||
test.socket["matter"]:__expect_send({mock_device_aqara.id, subscribe_request}) | ||
test.mock_device.add_test_device(mock_device_aqara) | ||
end | ||
test.set_test_init_function(test_init) | ||
|
||
test.register_coroutine_test( | ||
"doConfigure lifecycle event for base-lock-nobattery", | ||
function() | ||
test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) | ||
mock_device:expect_metadata_update({ profile = "base-lock-nobattery" }) | ||
mock_device:expect_metadata_update({ provisioning_state = "PROVISIONED" }) | ||
end | ||
) | ||
|
||
test.register_coroutine_test( | ||
"doConfigure lifecycle event for aqara lock", | ||
function() | ||
test.socket.device_lifecycle:__queue_receive({ mock_device_aqara.id, "doConfigure" }) | ||
mock_device_aqara:expect_metadata_update({ provisioning_state = "PROVISIONED" }) | ||
end | ||
) | ||
|
||
test.run_registered_tests() |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
@hcarter-775
I am confused that if device do not have attribute 0x000D BatTimeRemaining, then device will also matched "-batteryLevel". In this case, device will not report BatTimeRemaining, if plugin has problem with device status not updated error, for example like this.