diff --git a/drivers/SmartThings/zigbee-switch/fingerprints.yml b/drivers/SmartThings/zigbee-switch/fingerprints.yml index e449e1f194..fb4e415088 100644 --- a/drivers/SmartThings/zigbee-switch/fingerprints.yml +++ b/drivers/SmartThings/zigbee-switch/fingerprints.yml @@ -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 diff --git a/drivers/SmartThings/zigbee-switch/profiles/aqara-light.yml b/drivers/SmartThings/zigbee-switch/profiles/aqara-light.yml index 3b4462bce2..6c2da08393 100644 --- a/drivers/SmartThings/zigbee-switch/profiles/aqara-light.yml +++ b/drivers/SmartThings/zigbee-switch/profiles/aqara-light.yml @@ -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 diff --git a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua index 3009cb6d0c..1d4e9a9770 100644 --- a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua @@ -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) @@ -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 + local aqara_light_handler = { NAME = "Aqara Light Handler", lifecycle_handlers = { + init = init, added = device_added, doConfigure = do_configure }, diff --git a/drivers/SmartThings/zigbee-switch/src/preferences.lua b/drivers/SmartThings/zigbee-switch/src/preferences.lua index f0170aaf40..9584ac0840 100644 --- a/drivers/SmartThings/zigbee-switch/src/preferences.lua +++ b/drivers/SmartThings/zigbee-switch/src/preferences.lua @@ -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 = { diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua index 9c7a7cc0e5..64ab249fc0 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_led_bulb.lua @@ -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 @@ -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) diff --git a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua index 68f54c986f..ad92ef59e1 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua @@ -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 @@ -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)