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

local is_aqara_products = function(opts, driver, device)
local FINGERPRINTS = require "aqara.fingerprints"
if FINGERPRINTS[device:get_model()] and FINGERPRINTS[device:get_model()].mfr == device:get_manufacturer() then
return true, require("aqara")
end
return false
end

return is_aqara_products
13 changes: 13 additions & 0 deletions drivers/SmartThings/zigbee-button/src/aqara/fingerprints.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local FINGERPRINTS = {
["lumi.remote.b1acn02"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Mini Switch T1
["lumi.remote.acn003"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch E1 (Single Rocker)
["lumi.remote.b186acn03"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch T1 (Single Rocker)
["lumi.remote.b286acn03"] = { mfr = "LUMI", btn_cnt = 3, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch T1 (Double Rocker)
["lumi.remote.b18ac1"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2450", quantity = 1 }, -- Aqara Wireless Remote Switch H1 (Single Rocker)
["lumi.remote.b28ac1"] = { mfr = "LUMI", btn_cnt = 3, type = "CR2450", quantity = 1 } -- Aqara Wireless Remote Switch H1 (Double Rocker)
}

return FINGERPRINTS
45 changes: 10 additions & 35 deletions drivers/SmartThings/zigbee-button/src/aqara/init.lua
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
-- 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.
-- Copyright 2024 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local battery_defaults = require "st.zigbee.defaults.battery_defaults"
local clusters = require "st.zigbee.zcl.clusters"
Expand All @@ -34,14 +24,7 @@ local MULTISTATE_INPUT_CLUSTER_ID = 0x0012
local PRESENT_ATTRIBUTE_ID = 0x0055

local COMP_LIST = { "button1", "button2", "all" }
local AQARA_REMOTE_SWITCH = {
["lumi.remote.b1acn02"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Mini Switch T1
["lumi.remote.acn003"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch E1 (Single Rocker)
["lumi.remote.b186acn03"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch T1 (Single Rocker)
["lumi.remote.b286acn03"] = { mfr = "LUMI", btn_cnt = 3, type = "CR2032", quantity = 1 }, -- Aqara Wireless Remote Switch T1 (Double Rocker)
["lumi.remote.b18ac1"] = { mfr = "LUMI", btn_cnt = 1, type = "CR2450", quantity = 1 }, -- Aqara Wireless Remote Switch H1 (Single Rocker)
["lumi.remote.b28ac1"] = { mfr = "LUMI", btn_cnt = 3, type = "CR2450", quantity = 1 } -- Aqara Wireless Remote Switch H1 (Double Rocker)
}
local FINGERPRINTS = require "aqara.fingerprints"

local configuration = {
{
Expand All @@ -65,7 +48,7 @@ local configuration = {
local function present_value_attr_handler(driver, device, value, zb_rx)
if value.value < 0xFF then
local end_point = zb_rx.address_header.src_endpoint.value
local btn_evt_cnt = AQARA_REMOTE_SWITCH[device:get_model()].btn_cnt or 1
local btn_evt_cnt = FINGERPRINTS[device:get_model()].btn_cnt or 1
local evt = capabilities.button.button.held({ state_change = true })
if value.value == 1 then
evt = capabilities.button.button.pushed({ state_change = true })
Expand Down Expand Up @@ -110,7 +93,7 @@ local function battery_level_handler(driver, device, value, zb_rx)
end

local function mode_switching_handler(driver, device, value, zb_rx)
local btn_evt_cnt = AQARA_REMOTE_SWITCH[device:get_model()].btn_cnt or 1
local btn_evt_cnt = FINGERPRINTS[device:get_model()].btn_cnt or 1
local allow = device.preferences[MODE_CHANGE] or false
if allow then
local mode = device:get_field(MODE) or 1
Expand Down Expand Up @@ -139,14 +122,6 @@ local function mode_switching_handler(driver, device, value, zb_rx)
end
end

local is_aqara_products = function(opts, driver, device)
local isAqaraProducts = false
if AQARA_REMOTE_SWITCH[device:get_model()] and AQARA_REMOTE_SWITCH[device:get_model()].mfr == device:get_manufacturer() then
isAqaraProducts = true
end
return isAqaraProducts
end

local function device_init(driver, device)
battery_defaults.build_linear_voltage_init(2.6, 3.0)(driver, device)
if configuration ~= nil then
Expand All @@ -157,11 +132,11 @@ local function device_init(driver, device)
end

local function added_handler(self, device)
local btn_evt_cnt = AQARA_REMOTE_SWITCH[device:get_model()].btn_cnt or 1
local btn_evt_cnt = FINGERPRINTS[device:get_model()].btn_cnt or 1
local mode = device:get_field(MODE) or 0
local model = device:get_model()
local type = AQARA_REMOTE_SWITCH[device:get_model()].type or "CR2032"
local quantity = AQARA_REMOTE_SWITCH[device:get_model()].quantity or 1
local type = FINGERPRINTS[device:get_model()].type or "CR2032"
local quantity = FINGERPRINTS[device:get_model()].quantity or 1

if mode == 0 then
if model == "lumi.remote.b18ac1" or model == "lumi.remote.b28ac1" then
Expand Down Expand Up @@ -233,7 +208,7 @@ local aqara_wireless_switch_handler = {
}
}
},
can_handle = is_aqara_products
can_handle = require("aqara.can_handle"),
}

return aqara_wireless_switch_handler
15 changes: 2 additions & 13 deletions drivers/SmartThings/zigbee-button/src/button_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 capabilities = require "st.capabilities"
local log = require "log"
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_zigbee_dimming_remote(opts, driver, device, ...)
local FINGERPRINTS = require("dimming-remote.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("dimming-remote")
end
end
return false
end

return can_handle_zigbee_dimming_remote
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 ZIBEE_DIMMING_SWITCH_FINGERPRINTS = {
{ mfr = "OSRAM", model = "LIGHTIFY Dimming Switch" },
{ mfr = "CentraLite", model = "3130" }
}

return ZIBEE_DIMMING_SWITCH_FINGERPRINTS
30 changes: 4 additions & 26 deletions drivers/SmartThings/zigbee-button/src/dimming-remote/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 zcl_clusters = require "st.zigbee.zcl.clusters"
local capabilities = require "st.capabilities"
Expand All @@ -22,19 +12,7 @@ local battery_defaults = require "st.zigbee.defaults.battery_defaults"

local button_utils = require "button_utils"

local ZIBEE_DIMMING_SWITCH_FINGERPRINTS = {
{ mfr = "OSRAM", model = "LIGHTIFY Dimming Switch" },
{ mfr = "CentraLite", model = "3130" }
}

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

local function button_pushed_handler(button_number)
return function(self, device, value, zb_rx)
Expand Down Expand Up @@ -84,7 +62,7 @@ local dimming_remote = {
}
}
},
can_handle = can_handle_zigbee_dimming_remote
can_handle = require("dimming-remote.can_handle"),
}

return dimming_remote
14 changes: 14 additions & 0 deletions drivers/SmartThings/zigbee-button/src/ewelink/can_handle.lua
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_ewelink_button(opts, driver, device, ...)
local FINGERPRINTS = require("ewelink.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("ewelink")
end
end
return false
end

return can_handle_ewelink_button
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 EWELINK_BUTTON_FINGERPRINTS = {
{ mfr = "eWeLink", model = "WB01" },
{ mfr = "eWeLink", model = "SNZB-01P" }
}

return EWELINK_BUTTON_FINGERPRINTS
32 changes: 5 additions & 27 deletions drivers/SmartThings/zigbee-button/src/ewelink/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"
local clusters = require "st.zigbee.zcl.clusters"
Expand All @@ -19,19 +9,7 @@ local device_management = require "st.zigbee.device_management"
local OnOff = clusters.OnOff
local button = capabilities.button.button

local EWELINK_BUTTON_FINGERPRINTS = {
{ mfr = "eWeLink", model = "WB01" },
{ mfr = "eWeLink", model = "SNZB-01P" }
}

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

local function do_configure(driver, device)
device:configure()
Expand Down Expand Up @@ -61,7 +39,7 @@ local ewelink_button = {
}
}
},
can_handle = can_handle_ewelink_button
can_handle = require("ewelink.can_handle"),
}

return ewelink_button
return ewelink_button
18 changes: 18 additions & 0 deletions drivers/SmartThings/zigbee-button/src/ezviz/can_handle.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

local is_ezviz_button = function(opts, driver, device)

local EZVIZ_PRIVATE_BUTTON_CLUSTER = 0xFE05
local EZVIZ_PRIVATE_STANDARD_CLUSTER = 0xFE00
local EZVIZ_MFR = "EZVIZ"

local support_button_cluster = device:supports_server_cluster(EZVIZ_PRIVATE_BUTTON_CLUSTER)
local support_standard_cluster = device:supports_server_cluster(EZVIZ_PRIVATE_STANDARD_CLUSTER)
if device:get_manufacturer() == EZVIZ_MFR and support_button_cluster and support_standard_cluster then
return true, require("ezviz")
end
return false
end

return is_ezviz_button
29 changes: 5 additions & 24 deletions drivers/SmartThings/zigbee-button/src/ezviz/init.lua
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
-- Copyright 2025 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 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0


local capabilities = require "st.capabilities"

local EZVIZ_PRIVATE_BUTTON_CLUSTER = 0xFE05
local EZVIZ_PRIVATE_STANDARD_CLUSTER = 0xFE00
local EZVIZ_PRIVATE_BUTTON_ATTRIBUTE = 0x0000
local EZVIZ_MFR = "EZVIZ"

local is_ezviz_button = function(opts, driver, device)
local support_button_cluster = device:supports_server_cluster(EZVIZ_PRIVATE_BUTTON_CLUSTER)
local support_standard_cluster = device:supports_server_cluster(EZVIZ_PRIVATE_STANDARD_CLUSTER)
if device:get_manufacturer() == EZVIZ_MFR and support_button_cluster and support_standard_cluster then
return true
end
end

local ezviz_private_cluster_button_handler = function(driver, device, zb_rx)
local event
Expand Down Expand Up @@ -53,6 +34,6 @@ local ezviz_button_handler = {
}
}
},
can_handle = is_ezviz_button
can_handle = require("ezviz.can_handle"),
}
return ezviz_button_handler
return ezviz_button_handler
11 changes: 11 additions & 0 deletions drivers/SmartThings/zigbee-button/src/frient/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 frient_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "frient A/S" and (device:get_model() == "SBTZB-110" or device:get_model() == "MBTZB-110") then
return true, require("frient")
end
return false
end

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


local zcl_clusters = require "st.zigbee.zcl.clusters"
local cluster_base = require "st.zigbee.cluster_base"
Expand Down Expand Up @@ -232,8 +222,6 @@ local frient_button = {
}
}
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "frient A/S" and (device:get_model() == "SBTZB-110" or device:get_model() == "MBTZB-110")
end
can_handle = require("frient.can_handle"),
}
return frient_button
Loading
Loading