Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-lock/src/configurations.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local clusters = require "st.zigbee.zcl.clusters"

Expand Down
23 changes: 4 additions & 19 deletions drivers/SmartThings/zigbee-lock/src/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


-- Zigbee Driver utilities
local defaults = require "st.zigbee.defaults"
Expand Down Expand Up @@ -445,12 +435,7 @@ local zigbee_lock_driver = {
[capabilities.refresh.commands.refresh.NAME] = refresh
}
},
sub_drivers = {
require("samsungsds"),
require("yale"),
require("yale-fingerprint-lock"),
require("lock-without-codes")
},
sub_drivers = require("sub_drivers"),
lifecycle_handlers = {
doConfigure = do_configure,
added = device_added,
Expand Down
15 changes: 15 additions & 0 deletions drivers/SmartThings/zigbee-lock/src/lazy_load_subdriver.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

return function(sub_driver_name)
-- gets the current lua libs api version
local version = require "version"
local ZigbeeDriver = require "st.zigbee"
if version.api >= 16 then
return ZigbeeDriver.lazy_load_sub_driver_v2(sub_driver_name)
elseif version.api >= 9 then
return ZigbeeDriver.lazy_load_sub_driver(require(sub_driver_name))
else
return require(sub_driver_name)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle_lock_without_codes(opts, driver, device)
local FINGERPRINTS = require("lock-without-codes.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("lock-without-codes")
end
end
return false
end

return can_handle_lock_without_codes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local LOCK_WITHOUT_CODES_FINGERPRINTS = {
{ model = "E261-KR0B0Z0-HA" },
{ mfr = "Danalock", model = "V3-BTZB" }
}

return LOCK_WITHOUT_CODES_FINGERPRINTS
30 changes: 4 additions & 26 deletions drivers/SmartThings/zigbee-lock/src/lock-without-codes/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local configurationMap = require "configurations"
local clusters = require "st.zigbee.zcl.clusters"
Expand All @@ -19,19 +9,7 @@ local capabilities = require "st.capabilities"
local DoorLock = clusters.DoorLock
local PowerConfiguration = clusters.PowerConfiguration

local LOCK_WITHOUT_CODES_FINGERPRINTS = {
{ model = "E261-KR0B0Z0-HA" },
{ mfr = "Danalock", model = "V3-BTZB" }
}

local function can_handle_lock_without_codes(opts, driver, device)
for _, fingerprint in ipairs(LOCK_WITHOUT_CODES_FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true
end
end
return false
end

local function device_init(driver, device)
local configuration = configurationMap.get_device_configuration(device)
Expand Down Expand Up @@ -95,7 +73,7 @@ local lock_without_codes = {
}
}
},
can_handle = can_handle_lock_without_codes
can_handle = require("lock-without-codes.can_handle"),
}

return lock_without_codes
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-lock/src/lock_utils.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0
local utils = require "st.utils"
local capabilities = require "st.capabilities"
local json = require "st.json"
Expand Down
11 changes: 11 additions & 0 deletions drivers/SmartThings/zigbee-lock/src/samsungsds/can_handle.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function samsungsds_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "SAMSUNG SDS" then
return true, require("samsungsds")
end
return false
end

return samsungsds_can_handle
20 changes: 4 additions & 16 deletions drivers/SmartThings/zigbee-lock/src/samsungsds/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local device_management = require "st.zigbee.device_management"
local clusters = require "st.zigbee.zcl.clusters"
Expand Down Expand Up @@ -112,9 +102,7 @@ local samsung_sds_driver = {
added = device_added,
init = device_init
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "SAMSUNG SDS"
end
can_handle = require("samsungsds.can_handle"),
}

return samsung_sds_driver
11 changes: 11 additions & 0 deletions drivers/SmartThings/zigbee-lock/src/sub_drivers.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local lazy_load_if_possible = require "lazy_load_subdriver"
local sub_drivers = {
lazy_load_if_possible("samsungsds"),
lazy_load_if_possible("yale"),
lazy_load_if_possible("yale-fingerprint-lock"),
lazy_load_if_possible("lock-without-codes"),
}
return sub_drivers
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-lock/src/test/test_c2o_lock.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local test = require "integration_test"
local clusters = require "st.zigbee.zcl.clusters"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2023 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.
-- Copyright 2023 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down Expand Up @@ -45,4 +34,4 @@ test.register_coroutine_test(
end
)

test.run_registered_tests()
test.run_registered_tests()
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-lock/src/test/test_zigbee_lock.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-lock/src/test/test_zigbee_yale.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
-- Copyright 2022 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.
-- Copyright 2022 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

-- Mock out globals
local test = require "integration_test"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local yale_fingerprint_lock_models = function(opts, driver, device)
local FINGERPRINTS = require("yale-fingerprint-lock.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("yale-fingerprint-lock")
end
end
return false
end

return yale_fingerprint_lock_models
Loading
Loading