@@ -112,6 +112,29 @@ local mock_device_extended_color = test.mock_device.build_test_matter_device({
112112 }
113113})
114114
115+ local mock_device_extended_color_no_temp = test .mock_device .build_test_matter_device ({
116+ profile = t_utils .get_profile_definition (" light-color-level.yml" ),
117+ manufacturer_info = {
118+ vendor_id = 0x0000 ,
119+ product_id = 0x0000 ,
120+ },
121+ endpoints = {
122+ {
123+ endpoint_id = 1 ,
124+ clusters = {
125+ {cluster_id = clusters .OnOff .ID , cluster_type = " SERVER" },
126+ {cluster_id = clusters .ColorControl .ID , cluster_type = " BOTH" , feature_map = 14 },
127+ {cluster_id = clusters .LevelControl .ID , cluster_type = " SERVER" , feature_map = 2 }
128+ },
129+ device_types = {
130+ {device_type_id = 0x0100 , device_type_revision = 1 }, -- On/Off Light
131+ {device_type_id = 0x0101 , device_type_revision = 1 }, -- Dimmable Light
132+ {device_type_id = 0x010D , device_type_revision = 1 }, -- Extended Color Light
133+ }
134+ }
135+ }
136+ })
137+
115138local cluster_subscribe_list = {
116139 clusters .OnOff .attributes .OnOff ,
117140 clusters .LevelControl .attributes .CurrentLevel ,
@@ -216,6 +239,7 @@ local function test_init_color_temp()
216239 mock_device_color_temp .id ,
217240 clusters .ColorControl .attributes .Options :write (mock_device_color_temp , 1 , clusters .ColorControl .types .OptionsBitmap .EXECUTE_IF_OFF )
218241 })
242+ mock_device_color_temp :expect_metadata_update ({ profile = " light-level-colorTemperature" })
219243 mock_device_color_temp :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
220244 test .socket .matter :__expect_send ({mock_device_color_temp .id , subscribe_request })
221245end
@@ -243,22 +267,58 @@ local function test_init_extended_color()
243267 mock_device_extended_color .id ,
244268 clusters .ColorControl .attributes .Options :write (mock_device_extended_color , 1 , clusters .ColorControl .types .OptionsBitmap .EXECUTE_IF_OFF )
245269 })
270+ mock_device_extended_color :expect_metadata_update ({ profile = " light-color-level" })
246271 mock_device_extended_color :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
247272 test .socket .matter :__expect_send ({mock_device_extended_color .id , subscribe_request })
248273end
249274
275+ local function test_init_extended_color_no_temp ()
276+ test .mock_device .add_test_device (mock_device_extended_color_no_temp )
277+ local subscribe_request = cluster_subscribe_list [1 ]:subscribe (mock_device_extended_color_no_temp )
278+ for i , cluster in ipairs (cluster_subscribe_list ) do
279+ if i > 1 then
280+ subscribe_request :merge (cluster :subscribe (mock_device_extended_color_no_temp ))
281+ end
282+ end
283+ test .socket .matter :__expect_send ({mock_device_extended_color_no_temp .id , subscribe_request })
284+ test .socket .device_lifecycle :__queue_receive ({ mock_device_extended_color_no_temp .id , " added" })
285+
286+ test .socket .device_lifecycle :__queue_receive ({ mock_device_extended_color_no_temp .id , " init" })
287+ test .socket .matter :__expect_send ({mock_device_extended_color_no_temp .id , subscribe_request })
288+
289+ test .socket .device_lifecycle :__queue_receive ({ mock_device_extended_color_no_temp .id , " doConfigure" })
290+ test .socket .matter :__expect_send ({
291+ mock_device_extended_color_no_temp .id ,
292+ clusters .LevelControl .attributes .Options :write (mock_device_extended_color_no_temp , 1 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
293+ })
294+ test .socket .matter :__expect_send ({
295+ mock_device_extended_color_no_temp .id ,
296+ clusters .ColorControl .attributes .Options :write (mock_device_extended_color_no_temp , 1 , clusters .ColorControl .types .OptionsBitmap .EXECUTE_IF_OFF )
297+ })
298+ mock_device_extended_color_no_temp :expect_metadata_update ({ profile = " light-color-level-noTemp" })
299+ mock_device_extended_color_no_temp :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
300+ test .socket .matter :__expect_send ({mock_device_extended_color_no_temp .id , subscribe_request })
301+ end
302+
303+
250304test .register_message_test (
251- " Test that Color Temperature Light device does not switch profiles" ,
305+ " Test that Color Temperature Light device switches profiles" ,
252306 {},
253307 { test_init = test_init_color_temp }
254308)
255309
256310test .register_message_test (
257- " Test that Extended Color Light device does not switch profiles" ,
311+ " Test that Extended Color Light device switches profiles" ,
258312 {},
259313 { test_init = test_init_extended_color }
260314)
261315
316+ test .register_message_test (
317+ " Test that Extended Color Light device without color temperature switches profiles" ,
318+ {},
319+ { test_init = test_init_extended_color_no_temp }
320+ )
321+
262322test .register_message_test (
263323 " On command should send the appropriate commands" ,
264324 {
0 commit comments