@@ -143,7 +143,7 @@ local mock_device_mounted_on_off_control = test.mock_device.build_test_matter_de
143143 endpoint_id = 7 ,
144144 clusters = {
145145 {cluster_id = clusters .OnOff .ID , cluster_type = " SERVER" , cluster_revision = 1 , feature_map = 0 },
146- {cluster_id = clusters .LevelControl .ID , cluster_type = " CLIENT " , feature_map = 2 },
146+ {cluster_id = clusters .LevelControl .ID , cluster_type = " SERVER " , feature_map = 2 },
147147
148148 },
149149 device_types = {
@@ -173,7 +173,7 @@ local mock_device_mounted_dimmable_load_control = test.mock_device.build_test_ma
173173 endpoint_id = 7 ,
174174 clusters = {
175175 {cluster_id = clusters .OnOff .ID , cluster_type = " SERVER" , cluster_revision = 1 , feature_map = 0 },
176- {cluster_id = clusters .LevelControl .ID , cluster_type = " CLIENT " , feature_map = 2 },
176+ {cluster_id = clusters .LevelControl .ID , cluster_type = " SERVER " , feature_map = 2 },
177177
178178 },
179179 device_types = {
@@ -420,6 +420,10 @@ local function test_init_parent_child_switch_types()
420420 test .socket .matter :__expect_send ({mock_device_parent_child_switch_types .id , subscribe_request })
421421
422422 test .socket .device_lifecycle :__queue_receive ({ mock_device_parent_child_switch_types .id , " doConfigure" })
423+ test .socket .matter :__expect_send ({
424+ mock_device_parent_child_switch_types .id ,
425+ clusters .LevelControl .attributes .Options :write (mock_device_parent_child_switch_types , 7 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
426+ })
423427 mock_device_parent_child_switch_types :expect_metadata_update ({ profile = " switch-level" })
424428 mock_device_parent_child_switch_types :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
425429
463467local function test_init_dimmer ()
464468 test .mock_device .add_test_device (mock_device_dimmer )
465469 test .socket .device_lifecycle :__queue_receive ({ mock_device_dimmer .id , " doConfigure" })
470+ test .socket .matter :__expect_send ({
471+ mock_device_dimmer .id ,
472+ clusters .LevelControl .attributes .Options :write (mock_device_dimmer , 1 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
473+ })
466474 mock_device_dimmer :expect_metadata_update ({ profile = " switch-level" })
467475 mock_device_dimmer :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
468476end
@@ -494,6 +502,10 @@ local function test_init_mounted_on_off_control()
494502 test .socket .matter :__expect_send ({mock_device_mounted_on_off_control .id , subscribe_request })
495503
496504 test .socket .device_lifecycle :__queue_receive ({ mock_device_mounted_on_off_control .id , " doConfigure" })
505+ test .socket .matter :__expect_send ({
506+ mock_device_mounted_on_off_control .id ,
507+ clusters .LevelControl .attributes .Options :write (mock_device_mounted_on_off_control , 7 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
508+ })
497509 mock_device_mounted_on_off_control :expect_metadata_update ({ profile = " switch-binary" })
498510 mock_device_mounted_on_off_control :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
499511end
@@ -502,6 +514,9 @@ local function test_init_mounted_dimmable_load_control()
502514 test .mock_device .add_test_device (mock_device_mounted_dimmable_load_control )
503515 local cluster_subscribe_list = {
504516 clusters .OnOff .attributes .OnOff ,
517+ clusters .LevelControl .attributes .CurrentLevel ,
518+ clusters .LevelControl .attributes .MinLevel ,
519+ clusters .LevelControl .attributes .MaxLevel ,
505520 }
506521 local subscribe_request = cluster_subscribe_list [1 ]:subscribe (mock_device_mounted_dimmable_load_control )
507522 for i , cluster in ipairs (cluster_subscribe_list ) do
@@ -516,6 +531,10 @@ local function test_init_mounted_dimmable_load_control()
516531 test .socket .matter :__expect_send ({mock_device_mounted_dimmable_load_control .id , subscribe_request })
517532
518533 test .socket .device_lifecycle :__queue_receive ({ mock_device_mounted_dimmable_load_control .id , " doConfigure" })
534+ test .socket .matter :__expect_send ({
535+ mock_device_mounted_dimmable_load_control .id ,
536+ clusters .LevelControl .attributes .Options :write (mock_device_mounted_dimmable_load_control , 7 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
537+ })
519538 mock_device_mounted_dimmable_load_control :expect_metadata_update ({ profile = " switch-level" })
520539 mock_device_mounted_dimmable_load_control :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
521540end
@@ -557,6 +576,14 @@ local function test_init_parent_child_different_types()
557576 test .socket .matter :__expect_send ({mock_device_parent_child_different_types .id , subscribe_request })
558577
559578 test .socket .device_lifecycle :__queue_receive ({ mock_device_parent_child_different_types .id , " doConfigure" })
579+ test .socket .matter :__expect_send ({
580+ mock_device_parent_child_different_types .id ,
581+ clusters .LevelControl .attributes .Options :write (mock_device_parent_child_different_types , 10 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
582+ })
583+ test .socket .matter :__expect_send ({
584+ mock_device_parent_child_different_types .id ,
585+ clusters .ColorControl .attributes .Options :write (mock_device_parent_child_different_types , 10 , clusters .ColorControl .types .OptionsBitmap .EXECUTE_IF_OFF )
586+ })
560587 mock_device_parent_child_different_types :expect_metadata_update ({ profile = " switch-binary" })
561588 mock_device_parent_child_different_types :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
562589
@@ -575,6 +602,10 @@ local function test_init_parent_child_unsupported_device_type()
575602 test .socket .device_lifecycle :__queue_receive ({ mock_device_parent_child_unsupported_device_type .id , " init" })
576603 test .socket .device_lifecycle :__queue_receive ({ mock_device_parent_child_unsupported_device_type .id , " doConfigure" })
577604 mock_device_parent_child_unsupported_device_type :expect_metadata_update ({ profile = " switch-binary" })
605+ test .socket .matter :__expect_send ({
606+ mock_device_parent_child_unsupported_device_type .id ,
607+ clusters .LevelControl .attributes .Options :write (mock_device_parent_child_unsupported_device_type , 10 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
608+ })
578609 mock_device_parent_child_unsupported_device_type :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
579610
580611 mock_device_parent_child_unsupported_device_type :expect_device_create ({
@@ -609,6 +640,10 @@ local function test_init_light_level_motion()
609640 test .socket .matter :__expect_send ({mock_device_light_level_motion .id , subscribe_request })
610641
611642 test .socket .device_lifecycle :__queue_receive ({ mock_device_light_level_motion .id , " doConfigure" })
643+ test .socket .matter :__expect_send ({
644+ mock_device_light_level_motion .id ,
645+ clusters .LevelControl .attributes .Options :write (mock_device_light_level_motion , 1 , clusters .LevelControl .types .OptionsBitmap .EXECUTE_IF_OFF )
646+ })
612647 mock_device_light_level_motion :expect_metadata_update ({ profile = " light-level-motion" })
613648 mock_device_light_level_motion :expect_metadata_update ({ provisioning_state = " PROVISIONED" })
614649end
0 commit comments