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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: stse.initializedStateWithGuide
version: 1
- id: stse.shadeRotateState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: stse.deviceInitialization
version: 1
- id: firmwareUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: battery
version: 1
- id: firmwareUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: windowShadePreset
version: 1
- id: powerSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: refresh
version: 1
categories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: firmwareUpdate
version: 1
- id: refresh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ components:
version: 1
- id: windowShadeLevel
version: 1
- id: statelessWindowShadeLevelStep
version: 1
- id: windowShadePreset
version: 1
- id: firmwareUpdate
Expand Down
13 changes: 9 additions & 4 deletions drivers/SmartThings/zigbee-window-treatment/src/hanssem/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ local TUYA_CLUSTER = 0xEF00
local DP_TYPE_VALUE = "\x02"
local DP_TYPE_ENUM = "\x04"

local SeqNum = 0

-------- Send Command Function for Tuya Zigbee device -------------
-- ZigbeeMessageTx:
-- Uint16: 0x0000
Expand All @@ -45,6 +43,14 @@ local SeqNum = 0
-- ReadAttribute:
-- AttributeId: 0x0000

-- Get next sequence number for Tuya commands (per-device storage to avoid counter conflicts)
local function get_next_tuya_seq_num(device)
local seq = device:get_field("tuya_seq_num") or 0
seq = (seq + 1) % 65536
device:set_field("tuya_seq_num", seq)
return seq
end

local function SendCommand(device, DpId, Type, Value)
local addrh = Messages.AddressHeader(
ZigbeeConstants.HUB.ADDR, -- Source Address
Expand All @@ -57,8 +63,7 @@ local function SendCommand(device, DpId, Type, Value)
local zclh = ZigbeeZcl.ZclHeader({cmd = data_types.ZCLCommandId(0x00)})
zclh.frame_ctrl:set_cluster_specific() -- sets this frame control field to be cluster specific
-- Make a payload body
SeqNum = (SeqNum + 1) % 65536
local strSeqNum = string.pack(">I2", SeqNum) -- Pack the Sequence number to 2 bytes unsigned integer type with big endian.
local strSeqNum = string.pack(">I2", get_next_tuya_seq_num(device)) -- Pack the Sequence number to 2 bytes unsigned integer type with big endian.
local LenOfValue = string.pack(">I2",string.len(Value)) -- Pack length of Value to 2 bytes unsigned integer type wiht big endian.
local PayloadBody = generic_body.GenericBody(strSeqNum .. DpId .. Type .. LenOfValue .. Value)
local MsgBody = ZigbeeZcl.ZclMessageBody({zcl_header = zclh, zcl_body = PayloadBody})
Expand Down
5 changes: 4 additions & 1 deletion drivers/SmartThings/zigbee-window-treatment/src/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ local zigbee_window_treatment_driver_template = {
[capabilities.windowShadePreset.ID] = {
[capabilities.windowShadePreset.commands.setPresetPosition.NAME] = window_shade_utils.set_preset_position_cmd,
[capabilities.windowShadePreset.commands.presetPosition.NAME] = window_shade_utils.window_shade_preset_cmd,
}
},
[capabilities.statelessWindowShadeLevelStep.ID] = {
[capabilities.statelessWindowShadeLevelStep.commands.stepShadeLevel.NAME] = window_shade_utils.step_shade_level_handler()
},
},
lifecycle_handlers = {
init = init_handler,
Expand Down

This file was deleted.

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

local function invert_lift_percentage_can_handle(opts, driver, device, ...)
local somfy_can_handle = require("inverted-lift.somfy.can_handle")
local yoolax_can_handle = require("inverted-lift.yoolax.can_handle")
local rooms_beautiful_can_handle = require("inverted-lift.rooms-beautiful.can_handle")
local vimar_can_handle = require("inverted-lift.vimar.can_handle")
if somfy_can_handle(opts, driver, device)
or yoolax_can_handle(opts, driver, device)
or rooms_beautiful_can_handle(opts, driver, device)
or vimar_can_handle(opts, driver, device)
or device:get_manufacturer() == "IKEA of Sweden"
or device:get_manufacturer() == "Smartwings"
or device:get_manufacturer() == "Insta GmbH"
then
return true, require("inverted-lift")
end
return false
end

return invert_lift_percentage_can_handle
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ local function current_position_attr_handler(driver, device, value, zb_rx)
end
end

local function set_shade_level(device, value, command)
local function set_shade_level_helper(device, value, command)
local level = 100 - value
device:send_to_component(command.component, WindowCovering.server.commands.GoToLiftPercentage(device, level))
end

local function window_shade_level_cmd(driver, device, command)
set_shade_level(device, command.args.shadeLevel, command)
local function set_shade_level_handler(driver, device, command)
set_shade_level_helper(device, command.args.shadeLevel, command)
end

local function window_shade_preset_cmd(driver, device, command)
local function preset_position_handler(driver, device, command)
local level = window_shade_utils.get_preset_level(device, command.component)
set_shade_level(device, level, command)
set_shade_level_helper(device, level, command)
end

local ikea_window_treatment = {
local inverted_window_treatment = {
NAME = "inverted lift percentage",
zigbee_handlers = {
attr = {
Expand All @@ -80,14 +80,19 @@ local ikea_window_treatment = {
}
},
capability_handlers = {
[capabilities.statelessWindowShadeLevelStep.ID] = {
[capabilities.statelessWindowShadeLevelStep.commands.stepShadeLevel.NAME] =
window_shade_utils.step_shade_level_handler(true) -- invert_shade_level is true for devices under this subdriver
},
[capabilities.windowShadeLevel.ID] = {
[capabilities.windowShadeLevel.commands.setShadeLevel.NAME] = window_shade_level_cmd
[capabilities.windowShadeLevel.commands.setShadeLevel.NAME] = set_shade_level_handler
},
[capabilities.windowShadePreset.ID] = {
[capabilities.windowShadePreset.commands.presetPosition.NAME] = window_shade_preset_cmd
}
[capabilities.windowShadePreset.commands.presetPosition.NAME] = preset_position_handler
},
},
can_handle = require("invert-lift-percentage.can_handle"),
can_handle = require("inverted-lift.can_handle"),
sub_drivers = require("inverted-lift.sub_drivers")
}

return ikea_window_treatment
return inverted_window_treatment
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
-- Licensed under the Apache License, Version 2.0

local is_zigbee_window_shade = function(opts, driver, device)
local FINGERPRINTS = require("rooms-beautiful.fingerprints")
local FINGERPRINTS = require("inverted-lift.rooms-beautiful.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("rooms-beautiful")
return true, require("inverted-lift.rooms-beautiful")
end
end
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ local rooms_beautiful_handler = {
init = battery_defaults.build_linear_voltage_init(2.5, 3.0),
infoChanged = info_changed
},
can_handle = require("rooms-beautiful.can_handle"),
can_handle = require("inverted-lift.rooms-beautiful.can_handle"),
}

return rooms_beautiful_handler
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
-- Licensed under the Apache License, Version 2.0

local is_zigbee_window_shade = function(opts, driver, device)
local FINGERPRINTS = require("somfy.fingerprints")
local FINGERPRINTS = require("inverted-lift.somfy.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("somfy")
return true, require("inverted-lift.somfy")
end
end
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ local somfy_handler = {
}
}
},
can_handle = require("somfy.can_handle"),
can_handle = require("inverted-lift.somfy.can_handle"),
}

return somfy_handler
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- Copyright 2026 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("inverted-lift.vimar"),
lazy_load_if_possible("inverted-lift.yoolax"),
lazy_load_if_possible("inverted-lift.rooms-beautiful"),
lazy_load_if_possible("inverted-lift.somfy"),
}
return sub_drivers
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
-- Licensed under the Apache License, Version 2.0

local is_zigbee_window_shade = function(opts, driver, device)
local FINGERPRINTS = require("vimar.fingerprints")
local FINGERPRINTS = require("inverted-lift.vimar.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("vimar")
return true, require("inverted-lift.vimar")
end
end
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ local vimar_handler = {
lifecycle_handlers = {
init = device_init
},
can_handle = require("vimar.can_handle"),
can_handle = require("inverted-lift.vimar.can_handle"),
}

return vimar_handler
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
-- Licensed under the Apache License, Version 2.0

local function is_yoolax_window_shade(opts, driver, device)
local FINGERPRINTS = require("yoolax.fingerprints")
local FINGERPRINTS = require("inverted-lift.yoolax.fingerprints")
for _, fingerprint in ipairs(FINGERPRINTS) do
if device:get_manufacturer() == fingerprint.mfr and device:get_model() == fingerprint.model then
return true, require("yoolax")
return true, require("inverted-lift.yoolax")
end
end
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ local yoolax_window_shade = {
}
},
},
can_handle = require("yoolax.can_handle"),
can_handle = require("inverted-lift.yoolax.can_handle"),
}

return yoolax_window_shade
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@

local lazy_load_if_possible = require "lazy_load_subdriver"
local sub_drivers = {
lazy_load_if_possible("vimar"),
lazy_load_if_possible("aqara"),
lazy_load_if_possible("feibit"),
lazy_load_if_possible("somfy"),
lazy_load_if_possible("invert-lift-percentage"),
lazy_load_if_possible("rooms-beautiful"),
lazy_load_if_possible("inverted-lift"),
lazy_load_if_possible("axis"),
lazy_load_if_possible("yoolax"),
lazy_load_if_possible("hanssem"),
lazy_load_if_possible("screen-innovations"),
lazy_load_if_possible("VIVIDSTORM"),
Expand Down
Loading