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
16 changes: 16 additions & 0 deletions drivers/SmartThings/zwave-button/src/apiv6_bugfix/can_handle.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function can_handle(opts, driver, device, cmd, ...)
local cc = require "st.zwave.CommandClass"
local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 })
local version = require "version"
if version.api == 6 and
cmd.cmd_class == cc.WAKE_UP and
cmd.cmd_id == WakeUp.NOTIFICATION then
return true, require("apiv6_bugfix")
end
return false
end

return can_handle
11 changes: 4 additions & 7 deletions drivers/SmartThings/zwave-button/src/apiv6_bugfix/init.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local cc = require "st.zwave.CommandClass"
local WakeUp = (require "st.zwave.CommandClass.WakeUp")({ version = 1 })


local function can_handle(opts, driver, device, cmd, ...)
local version = require "version"
return version.api == 6 and
cmd.cmd_class == cc.WAKE_UP and
cmd.cmd_id == WakeUp.NOTIFICATION
end

local function wakeup_notification(driver, device, cmd)
device:refresh()
Expand All @@ -20,7 +17,7 @@ local apiv6_bugfix = {
}
},
NAME = "apiv6_bugfix",
can_handle = can_handle
can_handle = require("apiv6_bugfix.can_handle"),
}

return apiv6_bugfix
16 changes: 3 additions & 13 deletions drivers/SmartThings/zwave-button/src/configurations.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 devices = {
AEOTEC_NANOMOTE_ONE = {
Expand Down
21 changes: 4 additions & 17 deletions drivers/SmartThings/zwave-button/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


local capabilities = require "st.capabilities"
--- @type st.zwave.defaults
Expand Down Expand Up @@ -41,10 +31,7 @@ local driver_template = {
lifecycle_handlers = {
added = added_handler,
},
sub_drivers = {
require("zwave-multi-button"),
require("apiv6_bugfix"),
}
sub_drivers = require("sub_drivers"),
}

defaults.register_for_default_handlers(driver_template, driver_template.supported_capabilities)
Expand Down
18 changes: 18 additions & 0 deletions drivers/SmartThings/zwave-button/src/lazy_load_subdriver.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- 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 ZwaveDriver = require "st.zwave.driver"
local version = require "version"

if version.api >= 16 then
return ZwaveDriver.lazy_load_sub_driver_v2(sub_driver_name)
elseif version.api >= 9 then
return ZwaveDriver.lazy_load_sub_driver(require(sub_driver_name))
else
return require(sub_driver_name)
end

end
9 changes: 9 additions & 0 deletions drivers/SmartThings/zwave-button/src/sub_drivers.lua
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 lazy_load_if_possible = require "lazy_load_subdriver"
local sub_drivers = {
lazy_load_if_possible("zwave-multi-button"),
lazy_load_if_possible("apiv6_bugfix"),
}
return sub_drivers
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 test = require "integration_test"
local capabilities = require "st.capabilities"
Expand Down
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 test = require "integration_test"
local capabilities = require "st.capabilities"
Expand Down
16 changes: 3 additions & 13 deletions drivers/SmartThings/zwave-button/src/test/test_zwave_button.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 test = require "integration_test"
local capabilities = require "st.capabilities"
Expand Down
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 test = require "integration_test"
local capabilities = require "st.capabilities"
Expand Down
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 test = require "integration_test"
local capabilities = require "st.capabilities"
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 function can_handle_aeotec_keyfob(opts, driver, device, ...)
local FINGERPRINTS = require("zwave-multi-button.aeotec-keyfob.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true, require("zwave-multi-button.aeotec-keyfob")
end
end
return false
end

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

local ZWAVE_AEOTEC_KEYFOB_FINGERPRINTS = {
{mfr = 0x0086, prod = 0x0101, model = 0x0058}, -- Aeotec KeyFob US
{mfr = 0x0086, prod = 0x0001, model = 0x0058}, -- Aeotec KeyFob EU
{mfr = 0x0086, prod = 0x0001, model = 0x0026} -- Aeotec Panic Button
}

return ZWAVE_AEOTEC_KEYFOB_FINGERPRINTS
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
-- 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

--- @type st.zwave.CommandClass.Configuration
local Configuration = (require "st.zwave.CommandClass.Configuration")({ version=4 })
--- @type st.zwave.CommandClass.Association
local Association = (require "st.zwave.CommandClass.Association")({ version=1 })

local ZWAVE_AEOTEC_KEYFOB_FINGERPRINTS = {
{mfr = 0x0086, prod = 0x0101, model = 0x0058}, -- Aeotec KeyFob US
{mfr = 0x0086, prod = 0x0001, model = 0x0058}, -- Aeotec KeyFob EU
{mfr = 0x0086, prod = 0x0001, model = 0x0026} -- Aeotec Panic Button
}

local function can_handle_aeotec_keyfob(opts, driver, device, ...)
for _, fingerprint in ipairs(ZWAVE_AEOTEC_KEYFOB_FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true
end
end
return false
end

local do_configure = function(self, device)
device:refresh()
device:send(Configuration:Set({ configuration_value = 1, parameter_number = 250, size = 1 }))
Expand All @@ -43,7 +17,7 @@ local aeotec_keyfob = {
lifecycle_handlers = {
doConfigure = do_configure
},
can_handle = can_handle_aeotec_keyfob,
can_handle = require("zwave-multi-button.aeotec-keyfob.can_handle"),
}

return aeotec_keyfob
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_aeotec_minimote(opts, driver, device, ...)
local FINGERPRINTS = require("zwave-multi-button.aeotec-minimote.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true, require("zwave-multi-button.aeotec-minimote")
end
end
return false
end

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

local ZWAVE_AEOTEC_MINIMOTE_FINGERPRINTS = {
{mfr = 0x0086, prod = 0x0001, model = 0x0003} -- Aeotec Mimimote
}

return ZWAVE_AEOTEC_MINIMOTE_FINGERPRINTS
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 capabilities = require "st.capabilities"
--- @type st.zwave.CommandClass
Expand All @@ -20,18 +10,7 @@ local Basic = (require "st.zwave.CommandClass.Basic")({ version = 1 })
--- @type st.zwave.CommandClass.Configuration
local Configuration = (require "st.zwave.CommandClass.Configuration")({ version=4 })

local ZWAVE_AEOTEC_MINIMOTE_FINGERPRINTS = {
{mfr = 0x0086, prod = 0x0001, model = 0x0003} -- Aeotec Mimimote
}

local function can_handle_aeotec_minimote(opts, driver, device, ...)
for _, fingerprint in ipairs(ZWAVE_AEOTEC_MINIMOTE_FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true
end
end
return false
end

local function basic_set_handler(self, device, cmd)
local button = cmd.args.value // 40 + 1
Expand Down Expand Up @@ -59,7 +38,7 @@ local aeotec_minimote = {
lifecycle_handlers = {
doConfigure = do_configure
},
can_handle = can_handle_aeotec_minimote,
can_handle = require("zwave-multi-button.aeotec-minimote.can_handle"),
}

return aeotec_minimote
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_zwave_multi_button(opts, driver, device, ...)
local FINGERPRINTS = require("zwave-multi-button.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:id_match(fingerprint.mfr, fingerprint.prod, fingerprint.model) then
return true, require("zwave-multi-button")
end
end
return false
end

return can_handle_zwave_multi_button
Loading
Loading