diff --git a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua index a264b26018..7225246299 100644 --- a/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua +++ b/drivers/SmartThings/zigbee-switch/src/aqara-light/init.lua @@ -33,17 +33,15 @@ local function do_refresh(self, device) end local function do_configure(self, device) - device:send(ColorControl.commands.MoveToColorTemperature(device, 200, 0x0000)) device:configure() - do_refresh(self, device) -end - -local function device_added(driver, device, event) device:send(cluster_base.write_manufacturer_specific_attribute(device, PRIVATE_CLUSTER_ID, PRIVATE_ATTRIBUTE_ID, MFG_CODE, data_types.Uint8, 1)) -- private device:send(Level.attributes.OnTransitionTime:write(device, 0)) device:send(Level.attributes.OffTransitionTime:write(device, 0)) + device:send(ColorControl.commands.MoveToColorTemperature(device, 200, 0x0000)) + + do_refresh(self, device) end local function set_level_handler(driver, device, cmd) @@ -56,7 +54,6 @@ end local aqara_light_handler = { NAME = "Aqara Light Handler", lifecycle_handlers = { - added = device_added, doConfigure = do_configure }, capability_handlers = { 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 86c8d63058..f3b86453dd 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 @@ -53,9 +53,10 @@ end test.set_test_init_function(test_init) test.register_coroutine_test( - "Handle added lifecycle", + "Configure should configure all necessary attributes and refresh device", function() - test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) + test.socket.zigbee:__set_channel_ordering("relaxed") test.socket.zigbee:__expect_send( { @@ -66,15 +67,6 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 0) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 0) }) - end -) - -test.register_coroutine_test( - "Configure should configure all necessary attributes and refresh device", - function() - test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) - test.socket.zigbee:__set_channel_ordering("relaxed") - test.socket.zigbee:__expect_send( { mock_device.id, 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 0a6b63fbda..a9517ab626 100644 --- a/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua +++ b/drivers/SmartThings/zigbee-switch/src/test/test_aqara_light.lua @@ -54,9 +54,10 @@ end test.set_test_init_function(test_init) test.register_coroutine_test( - "Handle added lifecycle", + "Configure should configure all necessary attributes and refresh device", function() - test.socket.device_lifecycle:__queue_receive({ mock_device.id, "added" }) + test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) + test.socket.zigbee:__set_channel_ordering("relaxed") test.socket.zigbee:__expect_send( { @@ -67,15 +68,6 @@ test.register_coroutine_test( ) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OnTransitionTime:write(mock_device, 0) }) test.socket.zigbee:__expect_send({ mock_device.id, Level.attributes.OffTransitionTime:write(mock_device, 0) }) - end -) - -test.register_coroutine_test( - "Configure should configure all necessary attributes and refresh device", - function() - test.socket.device_lifecycle:__queue_receive({ mock_device.id, "doConfigure" }) - test.socket.zigbee:__set_channel_ordering("relaxed") - test.socket.zigbee:__expect_send( { mock_device.id,