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
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
Expand Up @@ -118,9 +118,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
19 changes: 2 additions & 17 deletions drivers/SmartThings/zigbee-motion-sensor/src/aqara/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,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 +28,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 +110,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,9 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra newline

-- 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
4 changes: 1 addition & 3 deletions drivers/SmartThings/zigbee-motion-sensor/src/aurora/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline at end of file

Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,13 @@

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_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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation

return true, require("centralite")
end
return false
end

return centralite_can_handle
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,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
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,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
15 changes: 1 addition & 14 deletions drivers/SmartThings/zigbee-motion-sensor/src/frient/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,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 +201,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
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 gatorsystem_can_handle(opts, driver, device, ...)
if device:get_manufacturer() == "GatorSystem" and device:get_model() == "GSHW01" then
return true, require("gatorsystem")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation

end
return false
end

return gatorsystem_can_handle
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ local gator_handler = {
added = device_added,
doConfigure = do_configure
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "GatorSystem" and device:get_model() == "GSHW01"
end
can_handle = require("gatorsystem.can_handle"),
}

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

return is_ikea_motion
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 IKEA_MOTION_SENSOR_FINGERPRINTS = {
{ mfr = "IKEA of Sweden", model = "TRADFRI motion sensor" }
}

return IKEA_MOTION_SENSOR_FINGERPRINTS
13 changes: 1 addition & 12 deletions drivers/SmartThings/zigbee-motion-sensor/src/ikea/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ local OnOff = clusters.OnOff
local PowerConfiguration = clusters.PowerConfiguration
local Groups = clusters.Groups

local IKEA_MOTION_SENSOR_FINGERPRINTS = {
{ mfr = "IKEA of Sweden", model = "TRADFRI motion sensor" }
}

local MOTION_RESET_TIMER = "motionResetTimer"
local ENTRIES_READ = "ENTRIES_READ"
Expand All @@ -48,14 +45,6 @@ local function on_with_timed_off_command_handler(driver, device, zb_rx)
device:set_field(MOTION_RESET_TIMER, motion_reset_timer)
end

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

local function zdo_binding_table_handler(driver, device, zb_rx)
for _, binding_table in pairs(zb_rx.body.zdo_body.binding_table_entries) do
Expand Down Expand Up @@ -141,7 +130,7 @@ local ikea_motion_sensor = {
added = device_added,
doConfigure = do_configure
},
can_handle = is_ikea_motion
can_handle = require("ikea.can_handle"),
}

return ikea_motion_sensor
Loading
Loading