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
5 changes: 5 additions & 0 deletions drivers/SmartThings/zigbee-switch/fingerprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ zigbeeManufacturer:
manufacturer: LUMI
model: lumi.light.acn004
deviceProfileName: aqara-light
- id: "LUMI/lumi.light.cwacn1"
deviceLabel: Aqara Smart Dimmer Controller T1 (0-10v)
manufacturer: LUMI
model: lumi.light.cwacn1
deviceProfileName: aqara-light
- id: "Aqara/lumi.light.acn014"
deviceLabel: Aqara LED Light Bulb T1 (Tunable White)
manufacturer: Aqara
Expand Down
4 changes: 0 additions & 4 deletions drivers/SmartThings/zigbee-switch/profiles/aqara-light.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ components:
range: [1, 100]
- id: colorTemperature
version: 1
config:
values:
- key: "colorTemperature.value"
range: [2700, 6000]
- id: firmwareUpdate
version: 1
- id: refresh
Expand Down
14 changes: 13 additions & 1 deletion drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ local MFG_CODE = 0x115F

local FINGERPRINTS = {
{ mfr = "LUMI", model = "lumi.light.acn004" },
{ mfr = "Aqara", model = "lumi.light.acn014" }
{ mfr = "Aqara", model = "lumi.light.acn014" },
{ mfr = "LUMI", model = "lumi.light.cwacn1" }
}

local function is_aqara_products(opts, driver, device)
Expand Down Expand Up @@ -54,9 +55,20 @@ local function set_level_handler(driver, device, cmd)
device:send(Level.commands.MoveToLevelWithOnOff(device, level, dimming_rate))
end

local function init(self, device)
local min = 2700
local max = 6000

if device:get_model() == "lumi.light.cwacn1" then
max = 6500
end
device:emit_event(capabilities.colorTemperature.colorTemperatureRange({ minimum = min, maximum = max }))
end

Comment on lines +58 to +67
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the instinct here so that existing devices get this change, but we do not want this event to fire every time the driver starts.

I would add this event to the added handler as well, and a follow-up PR a week later should be created to remove this code here in init. I'd also add gating to check for an existing colorTemperatureRange value before emitting this event.

local aqara_light_handler = {
NAME = "Aqara Light Handler",
lifecycle_handlers = {
init = init,
added = device_added,
doConfigure = do_configure
},
Expand Down
21 changes: 21 additions & 0 deletions drivers/SmartThings/zigbee-switch/src/preferences.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,27 @@ local devices = {
end
}
},
AQARA_DIMMER = {
MATCHING_MATRIX = { mfr = "LUMI", model = "lumi.light.cwacn1" },
PARAMETERS = {
["stse.restorePowerState"] = function(device, value)
return cluster_base.write_manufacturer_specific_attribute(device, 0xFCC0,
0x0201, 0x115F, data_types.Boolean, value)
end,
["stse.turnOffIndicatorLight"] = function(device, value)
return cluster_base.write_manufacturer_specific_attribute(device, 0xFCC0,
0x0203, 0x115F, data_types.Boolean, value)
end,
["stse.lightFadeInTimeInSec"] = function(device, value)
local raw_value = value * 10 -- value unit: 1sec, transition time unit: 100ms
return clusters.Level.attributes.OnTransitionTime:write(device, raw_value)
end,
["stse.lightFadeOutTimeInSec"] = function(device, value)
local raw_value = value * 10 -- value unit: 1sec, transition time unit: 100ms
return clusters.Level.attributes.OffTransitionTime:write(device, raw_value)
end
}
},
AQARA_LIGHT_BULB = {
MATCHING_MATRIX = { mfr = "Aqara", model = "lumi.light.acn014" },
PARAMETERS = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local clusters = require "st.zigbee.zcl.clusters"
local cluster_base = require "st.zigbee.cluster_base"
local data_types = require "st.zigbee.data_types"
local zigbee_test_utils = require "integration_test.zigbee_test_utils"
local capabilities = require "st.capabilities"

local OnOff = clusters.OnOff
local Level = clusters.Level
Expand Down Expand Up @@ -48,6 +49,7 @@ zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
test.mock_device.add_test_device(mock_device)
test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 })))
end

test.set_test_init_function(test_init)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local clusters = require "st.zigbee.zcl.clusters"
local cluster_base = require "st.zigbee.cluster_base"
local data_types = require "st.zigbee.data_types"
local zigbee_test_utils = require "integration_test.zigbee_test_utils"
local capabilities = require "st.capabilities"

local OnOff = clusters.OnOff
local Level = clusters.Level
Expand Down Expand Up @@ -50,6 +51,7 @@ zigbee_test_utils.prepare_zigbee_env_info()

local function test_init()
test.mock_device.add_test_device(mock_device)
test.socket.capability:__expect_send(mock_device:generate_test_message("main", capabilities.colorTemperature.colorTemperatureRange({ minimum = 2700, maximum = 6000 })))
end

test.set_test_init_function(test_init)
Expand Down
Loading