Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local capabilities = require "st.capabilities"

local aqara_utils = {}
Expand Down
14 changes: 14 additions & 0 deletions drivers/SmartThings/zigbee-motion-sensor/src/aqara/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 is_aqara_products = function(opts, driver, device)
local FINGERPRINTS = require("aqara.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("aqara")
end
end
return false
end

return is_aqara_products
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 FINGERPRINTS = {
{ mfr = "LUMI", model = "lumi.motion.ac02" },
{ mfr = "LUMI", model = "lumi.motion.agl02" },
{ mfr = "LUMI", model = "lumi.motion.agl04" }
}

return FINGERPRINTS
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

return function(opts, driver, device, ...)
if device:get_model() == "lumi.motion.agl04" then
return true, require("aqara.high-precision-motion")
end
return false
end
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local capabilities = require "st.capabilities"
local clusters = require "st.zigbee.zcl.clusters"
local cluster_base = require "st.zigbee.cluster_base"
Expand Down Expand Up @@ -118,9 +121,7 @@ local aqara_high_precision_motion_handler = {
}
}
},
can_handle = function(opts, driver, device, ...)
return device:get_model() == "lumi.motion.agl04"
end
can_handle = require("aqara.high-precision-motion.can_handle")
}

return aqara_high_precision_motion_handler
22 changes: 5 additions & 17 deletions drivers/SmartThings/zigbee-motion-sensor/src/aqara/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local capabilities = require "st.capabilities"
local zcl_commands = require "st.zigbee.zcl.global_commands"
local clusters = require "st.zigbee.zcl.clusters"
Expand All @@ -16,11 +19,6 @@ local FREQUENCY_ATTRIBUTE_ID = 0x0102

local MOTION_DETECTED_UINT32 = 65536

local FINGERPRINTS = {
{ mfr = "LUMI", model = "lumi.motion.ac02" },
{ mfr = "LUMI", model = "lumi.motion.agl02" },
{ mfr = "LUMI", model = "lumi.motion.agl04" }
}

local CONFIGURATIONS = {
{
Expand All @@ -33,14 +31,6 @@ local CONFIGURATIONS = {
}
}

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

local function motion_illuminance_attr_handler(driver, device, value, zb_rx)
-- The low 16 bits for Illuminance
Expand Down Expand Up @@ -123,10 +113,8 @@ local aqara_motion_handler = {
}
}
},
sub_drivers = {
require("aqara.high-precision-motion")
},
can_handle = is_aqara_products
sub_drivers = require("aqara.sub_drivers"),
can_handle = require("aqara.can_handle"),
}

return aqara_motion_handler
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 lazy_load = require "lazy_load_subdriver"

return {
lazy_load("aqara.high-precision-motion")
}
11 changes: 11 additions & 0 deletions drivers/SmartThings/zigbee-motion-sensor/src/aurora/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 aurora_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "Aurora" and device:get_model() == "MotionSensor51AU" then
return true, require("aurora")
end
return false
end

return aurora_can_handle
20 changes: 4 additions & 16 deletions drivers/SmartThings/zigbee-motion-sensor/src/aurora/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 function added_handler(self, device)
Expand All @@ -24,9 +14,7 @@ local aurora_motion_driver = {
lifecycle_handlers = {
added = added_handler,
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "Aurora" and device:get_model() == "MotionSensor51AU"
end
can_handle = require("aurora.can_handle"),
}

return aurora_motion_driver
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 can_handle_battery_voltage = function(opts, driver, device, ...)
local FINGERPRINTS = require("battery-voltage.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("battery-voltage")
end
end
return false
end

return can_handle_battery_voltage
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 DEVICES_REPORTING_BATTERY_VOLTAGE = {
{ mfr = "Bosch", model = "RFPR-ZB" },
{ mfr = "Bosch", model = "RFDL-ZB-MS" },
{ mfr = "Ecolink", model = "PIRZB1-ECO" },
{ mfr = "ADUROLIGHT", model = "VMS_ADUROLIGHT" },
{ mfr = "AduroSmart Eria", model = "VMS_ADUROLIGHT" }
}

return DEVICES_REPORTING_BATTERY_VOLTAGE
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
-- 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 battery_defaults = require "st.zigbee.defaults.battery_defaults"

local DEVICES_REPORTING_BATTERY_VOLTAGE = {
{ mfr = "Bosch", model = "RFPR-ZB" },
{ mfr = "Bosch", model = "RFDL-ZB-MS" },
{ mfr = "Ecolink", model = "PIRZB1-ECO" },
{ mfr = "ADUROLIGHT", model = "VMS_ADUROLIGHT" },
{ mfr = "AduroSmart Eria", model = "VMS_ADUROLIGHT" }
}

local can_handle_battery_voltage = function(opts, driver, device, ...)
for _, fingerprint in ipairs(DEVICES_REPORTING_BATTERY_VOLTAGE) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true
end
end
return false
end
local battery_defaults = require "st.zigbee.defaults.battery_defaults"


local battery_voltage_motion = {
NAME = "Battery Voltage Motion Sensor",
lifecycle_handlers = {
init = battery_defaults.build_linear_voltage_init(2.1, 3.0)
},
can_handle = can_handle_battery_voltage
can_handle = require("battery-voltage.can_handle"),
}

return battery_voltage_motion
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 centralite_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "CentraLite" then
return true, require("centralite")
end
return false
end

return centralite_can_handle
20 changes: 4 additions & 16 deletions drivers/SmartThings/zigbee-motion-sensor/src/centralite/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 battery_defaults = require "st.zigbee.defaults.battery_defaults"
local zcl_clusters = require "st.zigbee.zcl.clusters"
Expand Down Expand Up @@ -46,9 +36,7 @@ local centralite_handler = {
lifecycle_handlers = {
init = init_handler
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "CentraLite"
end
can_handle = require("centralite.can_handle"),
}

return centralite_handler
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 compacta_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "Compacta" then
return true, require("compacta")
end
return false
end

return compacta_can_handle
20 changes: 4 additions & 16 deletions drivers/SmartThings/zigbee-motion-sensor/src/compacta/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


-- ZCL
local zcl_clusters = require "st.zigbee.zcl.clusters"
Expand Down Expand Up @@ -43,9 +33,7 @@ local compacta_driver = {
added = added_handler,
doConfigure = do_configure
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "Compacta"
end
can_handle = require("compacta.can_handle"),
}

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

return can_handle_frient_motion_sensor
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 FRIENT_DEVICE_FINGERPRINTS = {
{ mfr = "frient A/S", model = "MOSZB-140"},
{ mfr = "frient A/S", model = "MOSZB-141"},
{ mfr = "frient A/S", model = "MOSZB-153"}
}

return FRIENT_DEVICE_FINGERPRINTS
32 changes: 4 additions & 28 deletions drivers/SmartThings/zigbee-motion-sensor/src/frient/init.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 battery_defaults = require "st.zigbee.defaults.battery_defaults"
local capabilities = require "st.capabilities"
Expand All @@ -35,20 +24,7 @@ local POWER_CONFIGURATION_ENDPOINT = 0x23
local TEMPERATURE_ENDPOINT = 0x26
local ILLUMINANCE_ENDPOINT = 0x27

local FRIENT_DEVICE_FINGERPRINTS = {
{ mfr = "frient A/S", model = "MOSZB-140"},
{ mfr = "frient A/S", model = "MOSZB-141"},
{ mfr = "frient A/S", model = "MOSZB-153"}
}

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

local function occupancy_attr_handler(driver, device, occupancy, zb_rx)
device:emit_event(occupancy.value == 0x01 and capabilities.motionSensor.motion.active() or capabilities.motionSensor.motion.inactive())
Expand Down Expand Up @@ -214,6 +190,6 @@ local frient_motion_driver = {
[capabilities.refresh.commands.refresh.NAME] = do_refresh
}
},
can_handle = can_handle_frient_motion_sensor
can_handle = require("frient.can_handle"),
}
return frient_motion_driver
return frient_motion_driver
Loading
Loading