Skip to content
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 new-matter-lock driver #1624

Merged
merged 22 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b6c9c65
Add new-matter-lock driver
HunsupJung Sep 9, 2024
41bc486
Remove logging and fix typo
HunsupJung Sep 10, 2024
46870ab
Add call_with_delay to prevent duplicated event
HunsupJung Sep 19, 2024
a268604
Fix some issues
HunsupJung Sep 19, 2024
8bc9545
Merge branch 'main' into feature/new-matter-lock
HunsupJung Sep 25, 2024
ef622e0
Add DoorLock cluster for a hub using old lua-libs
HunsupJung Sep 26, 2024
45e3606
Remove duplicated guest after driver is changed
HunsupJung Oct 2, 2024
1b19d30
Modify test case
HunsupJung Oct 2, 2024
4ff6766
Update PR with some patch
HunsupJung Oct 8, 2024
9fdde26
Update subscribed_attributes and subscribed_events
HunsupJung Oct 8, 2024
7dc105c
Update process to check the busy state
HunsupJung Oct 8, 2024
6e09690
Add lock profile for a door lock that does not support user and pin
HunsupJung Oct 9, 2024
fcbcc3f
Modify set_cota_credential function
HunsupJung Oct 9, 2024
beb5dc1
Modify test_aqara_matter_lock
HunsupJung Oct 9, 2024
aca90c2
Simplify the operation related to the tables
HunsupJung Oct 10, 2024
65d52f9
Add addUser command and sequence
HunsupJung Oct 10, 2024
17d8148
Modify some code that are not clear
HunsupJung Oct 11, 2024
3035dbc
Add test unit file for new door lock driver
HunsupJung Oct 11, 2024
cf148fe
Merge branch 'main' into feature/new-matter-lock
ctowns Oct 11, 2024
5a79c21
Fix the process for COTA and some issues
HunsupJung Oct 15, 2024
966c64b
Update test unit file for new door lock driver
HunsupJung Oct 15, 2024
37709e8
Fix COTA issue and add test unit for COTA
HunsupJung Oct 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions drivers/SmartThings/matter-lock/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ matterManufacturer:
deviceLabel: Aqara Smart Lock U200
vendorId: 0x115F
productId: 0x2802
deviceProfileName: lock-lockalarm-nobattery
deviceProfileName: lock-user-pin
- id: "4447/10241"
deviceLabel: Aqara Smart Lock U300
vendorId: 0x115F
productId: 0x2801
deviceProfileName: lock-lockalarm-nobattery
deviceProfileName: lock-user-pin
#Level
- id: "4767/1"
deviceLabel: Level Lock Plus (Matter)
Expand All @@ -32,4 +32,4 @@ matterGeneric:
deviceLabel: Matter Door Lock
deviceTypes:
- id: 0x000A # Door Lock
deviceProfileName: base-lock
deviceProfileName: base-lock
HunsupJung marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: lock-user-pin-schedule
components:
- id: main
capabilities:
- id: lock
version: 1
config:
values:
- key: "lock.value"
enabledValues:
- locked
- unlocked
- not fully locked
- id: lockAlarm
version: 1
- id: remoteControlStatus
version: 1
- id: lockUsers
version: 1
- id: lockCredentials
version: 1
- id: lockSchedules
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
HunsupJung marked this conversation as resolved.
Show resolved Hide resolved
version: 1
categories:
- name: SmartLock
27 changes: 27 additions & 0 deletions drivers/SmartThings/matter-lock/profiles/lock-user-pin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lock-user-pin
components:
- id: main
capabilities:
- id: lock
version: 1
config:
values:
- key: "lock.value"
enabledValues:
- locked
- unlocked
- not fully locked
- id: lockAlarm
version: 1
- id: remoteControlStatus
version: 1
- id: lockUsers
version: 1
- id: lockCredentials
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
HunsupJung marked this conversation as resolved.
Show resolved Hide resolved
version: 1
categories:
- name: SmartLock
27 changes: 27 additions & 0 deletions drivers/SmartThings/matter-lock/profiles/lock-user-schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: lock-user-schedule
components:
- id: main
capabilities:
- id: lock
version: 1
config:
values:
- key: "lock.value"
enabledValues:
- locked
- unlocked
- not fully locked
- id: lockAlarm
version: 1
- id: remoteControlStatus
version: 1
- id: lockUsers
version: 1
- id: lockSchedules
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
tpmanley marked this conversation as resolved.
Show resolved Hide resolved
version: 1
categories:
- name: SmartLock
25 changes: 25 additions & 0 deletions drivers/SmartThings/matter-lock/profiles/lock-user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: lock-user
components:
- id: main
capabilities:
- id: lock
version: 1
config:
values:
- key: "lock.value"
enabledValues:
- locked
- unlocked
- not fully locked
- id: lockAlarm
version: 1
- id: remoteControlStatus
version: 1
- id: lockUsers
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
tpmanley marked this conversation as resolved.
Show resolved Hide resolved
version: 1
categories:
- name: SmartLock
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
local data_types = require "st.matter.data_types"
local TLVParser = require "st.matter.TLV.TLVParser"

local GetCredentialStatusResponse = {}

GetCredentialStatusResponse.NAME = "GetCredentialStatusResponse"
GetCredentialStatusResponse.ID = 0x0025
GetCredentialStatusResponse.field_defs = {
{
name = "credential_exists",
field_id = 0,
is_nullable = false,
is_optional = false,
data_type = require "st.matter.data_types.Boolean",
},
{
name = "user_index",
field_id = 1,
is_nullable = true,
is_optional = false,
data_type = require "st.matter.data_types.Uint16",
},
{
name = "creator_fabric_index",
field_id = 2,
is_nullable = true,
is_optional = false,
data_type = require "st.matter.data_types.Uint8",
},
{
name = "last_modified_fabric_index",
field_id = 3,
is_nullable = true,
is_optional = false,
data_type = require "st.matter.data_types.Uint8",
},
{
name = "next_credential_index",
field_id = 4,
is_nullable = true,
is_optional = false,
data_type = require "st.matter.data_types.Uint16",
},
}

function GetCredentialStatusResponse:augment_type(base_type_obj)
local elems = {}
for _, v in ipairs(base_type_obj.elements) do
for _, field_def in ipairs(self.field_defs) do
if field_def.field_id == v.field_id and
field_def.is_nullable and
(v.value == nil and v.elements == nil) then
elems[field_def.name] = data_types.validate_or_build_type(v, data_types.Null, field_def.field_name)
elseif field_def.field_id == v.field_id and not
(field_def.is_optional and v.value == nil) then
elems[field_def.name] = data_types.validate_or_build_type(v, field_def.data_type, field_def.field_name)
if field_def.element_type ~= nil then
for i, e in ipairs(elems[field_def.name].elements) do
elems[field_def.name].elements[i] = data_types.validate_or_build_type(e, field_def.element_type)
end
end
end
end
end
base_type_obj.elements = elems
end

function GetCredentialStatusResponse:build_test_command_response(device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index, interaction_status)
local function init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index)
local out = {}
local args = {credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index}
if #args > #self.field_defs then
error(self.NAME .. " received too many arguments")
end
for i,v in ipairs(self.field_defs) do
if v.is_optional and args[i] == nil then
out[v.name] = nil
elseif v.is_nullable and args[i] == nil then
out[v.name] = data_types.validate_or_build_type(args[i], data_types.Null, v.name)
out[v.name].field_id = v.field_id
elseif not v.is_optional and args[i] == nil then
out[v.name] = data_types.validate_or_build_type(v.default, v.data_type, v.name)
out[v.name].field_id = v.field_id
else
out[v.name] = data_types.validate_or_build_type(args[i], v.data_type, v.name)
out[v.name].field_id = v.field_id
end
end
setmetatable(out, {
__index = GetCredentialStatusResponse,
__tostring = GetCredentialStatusResponse.pretty_print
})
return self._cluster:build_cluster_command(
device,
out,
endpoint_id,
self._cluster.ID,
self.ID
)
end
local self_request = init(self, device, endpoint_id, credential_exists, user_index, creator_fabric_index, last_modified_fabric_index, next_credential_index)
return self._cluster:build_test_command_response(
device,
endpoint_id,
self._cluster.ID,
self.ID,
self_request.info_blocks[1].tlv,
interaction_status
)
end

function GetCredentialStatusResponse:init()
return nil
end

function GetCredentialStatusResponse:set_parent_cluster(cluster)
self._cluster = cluster
return self
end

function GetCredentialStatusResponse:deserialize(tlv_buf)
local data = TLVParser.decode_tlv(tlv_buf)
self:augment_type(data)
return data
end

setmetatable(GetCredentialStatusResponse, {__call = GetCredentialStatusResponse.init})

return GetCredentialStatusResponse
Loading
Loading