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
23 changes: 5 additions & 18 deletions drivers/SmartThings/matter-window-covering/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


--Note: Currently only support for window shades with the PositionallyAware Feature
--Note: No support for setting device into calibration mode, it must be done manually
Expand Down Expand Up @@ -376,11 +366,8 @@ local matter_driver_template = {
capabilities.battery,
capabilities.batteryLevel,
},
sub_drivers = {
-- for devices sending a position update while device is in motion
require("matter-window-covering-position-updates-while-moving")
}
sub_drivers = require("sub_drivers"),
}

local matter_driver = MatterDriver("matter-window-covering", matter_driver_template)
matter_driver:run()
matter_driver:run()
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

return function(sub_driver_name)
local MatterDriver = require "st.matter.driver"
local version = require "version"
if version.api >= 16 then
return MatterDriver.lazy_load_sub_driver_v2(sub_driver_name)
elseif version.api >= 9 then
return MatterDriver.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,19 @@
-- Copyright 2025 SmartThings, Inc.
-- Licensed under the Apache License, Version 2.0

local function is_matter_window_covering_position_updates_while_moving(opts, driver, device)
local device_lib = require "st.device"
if device.network_type ~= device_lib.NETWORK_TYPE_MATTER then
return false
end
local FINGERPRINTS = require("matter-window-covering-position-updates-while-moving.fingerprints")
for i, v in ipairs(FINGERPRINTS) do
if device.manufacturer_info.vendor_id == v[1] and
device.manufacturer_info.product_id == v[2] then
return true, require("matter-window-covering-position-updates-while-moving")
end
end
return false
end

return is_matter_window_covering_position_updates_while_moving
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 SUB_WINDOW_COVERING_VID_PID = {
{0x10e1, 0x1005} -- VDA
}

return SUB_WINDOW_COVERING_VID_PID
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
-- 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


local capabilities = require "st.capabilities"
local clusters = require "st.matter.clusters"
local device_lib = require "st.device"

local DEFAULT_LEVEL = 0
local STATE_MACHINE = "__state_machine"
Expand All @@ -27,22 +16,7 @@ local StateMachineEnum = {
STATE_CURRENT_POSITION_FIRED = 0x03
}

local SUB_WINDOW_COVERING_VID_PID = {
{0x10e1, 0x1005} -- VDA
}

local function is_matter_window_covering_position_updates_while_moving(opts, driver, device)
if device.network_type ~= device_lib.NETWORK_TYPE_MATTER then
return false
end
for i, v in ipairs(SUB_WINDOW_COVERING_VID_PID) do
if device.manufacturer_info.vendor_id == v[1] and
device.manufacturer_info.product_id == v[2] then
return true
end
end
return false
end

local function device_init(driver, device)
device:subscribe()
Expand Down Expand Up @@ -145,7 +119,7 @@ local matter_window_covering_position_updates_while_moving_handler = {
},
capability_handlers = {
},
can_handle = is_matter_window_covering_position_updates_while_moving,
can_handle = require("matter-window-covering-position-updates-while-moving.can_handle"),
}

return matter_window_covering_position_updates_while_moving_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_if_possible = require "lazy_load_subdriver"
local sub_drivers = {
lazy_load_if_possible("matter-window-covering-position-updates-while-moving"),
}
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
Loading